javascript - How can I get a function name when it is being called? -
I'm not sure whether this is a good idea or not, but I want to be able to get the name from within A function, while it's being called. The test code I wrote below seems to work, there is no conflict of name in it, but I can not find the name of the function without knowing it.
function and () {return "test"; }; Var x = {and: function and () {this. And return the .name; }}; Document.write (X.And ()); Is there a way to get it which is not binding on the reference (or the value of 'this') on the function?
Just this aggregation.callee.name;
Try this example using:
function MyFunc () {return arguments.callee.name; } Note that
Comments
Post a Comment