I'm having this problem in a real-world Project.
How to convert an "object" into a function in JavaScript?
I need at least as Steve said "to assign a method operator() to an object". Re-assign is not an option, because the object is too complex and it's not created within Javascript.
I have an object x (but not a function). And I want to call a method this way
x()
I tried to add an apply
and a call
method but it didn't work. It seems that Javascript remember always that "is not a function" (that's the error I obtain always).
Is there a way to "hack" the Spidermonkey engine to achieve this ?