Page 1 of 1

arguments.callee.name to get function name... does not work?

Posted: 04 October 2015, 12:47
by Rudolf

Code: Select all

mafonctionaffichesonnom: function(){
               console.log('name:'+arguments.callee.name);
        },
bonjour, arguments.callee.name gives nothing here because name should be after function keyword... I expect using an automatic insert for each function, without filling each time a string with the function name,...under php it's well done with:

Code: Select all

self:trace(__function__);
but under javscript, I unsucceed to find a similar trick.

What I see ... is that I have to put

Code: Select all

mafonctionaffichesonnom: function mafonctionaffichesonnom(){
               console.log('name:'+arguments.callee.name);
        },
and with that it's ok... but It's strange that I need to refactor all the names to let it work...
Is there any mean to get the reference name directly?