I often need in a function f
to retrieve a name of the method that points to f
. For example. Let's say we have a getMethodName(obj, methodFunction)
function that uses foreach
on obj
to find a property that is a link to methodFunction
:
obj = {
foo : function() {
var myName = getMethodName(obj, arguments.callee); // "foo"
}
}
How do I do this in strict mode where arguments.callee
is deprecated?