Is there a way to get the current function from within the current function?
Name it.
var f1 = function fOne() {
console.log(fOne); //fOne is reference to this function
}
console.log(fOne); //undefined - this is good, fOne does not pollute global context
Yes – arguments.callee
is the current function.
NOTE: This is deprecated in ECMAScript 5, and may cause a performance hit for tail-call recursion and the like. However, it does work in most major browsers.
In your case, f1
will also work.