Hi,
I'm working with a fairly complex Javascript program wich, at a given point, returns some nested anonymous functions.
Sometimes, when I try to "apply" one of such anonymous functions ("f" in this example)...
f.apply (this.context, args)
...I get an "f.apply is not a function" error.
It's weird, because alert(f) displays the function source code but typeof(f) returns "object" (not "function").
alert (f) --> displays "function (input) { self.checkToken (input, regex, callback) }"
Also, f.call and f.apply are undefined.
Checking the typeof(f) at some stages of execution always returns "function". I can't explain why, when I need to call the function, it casts to object.
I've tested the code against Firefox and Microsoft JScript engine, obtaining the same results.
Maybe I'm missing some basic aspect of Javascript anonymous blocks? :-\