For logging in some server side javascript, I had the need of getting the name of the method within the same method. There are 2 ways of doing this:
- accessing
- accessing
It does not always work though. ECMA strict mode does not allow it but their is no alternative either.
- accessing
arguments.callee.toString()
and applying regex extraction to get the name- accessing
arguments.callee.name
It does not always work though. ECMA strict mode does not allow it but their is no alternative either.