> but, unlike other dynamic (and many static) objects in most languages, do not offer any interfaces to manipulate and reason about them
Sure they do. You just need to start thinking of javascript as a functional language and all this stuff becomes much ... simpler.
First of all, why would you even need to reason about a function's internal state? That's a sign of a leaky abstraction.
Furthermore, every time you want to manipulate the internal state of a function, what you're really after is defining a better API to provide arguments to said function.
And if you still for some reason need to dick around with a function's internal state, just use partial function application.