creo que se puede hacer eso:
var name = arguments.callee.toString();
Para obtener más información sobre esto, echar un vistazo a this article.
function callTaker(a,b,c,d,e){
// arguments properties
console.log(arguments);
console.log(arguments.length);
console.log(arguments.callee);
console.log(arguments[1]);
// Function properties
console.log(callTaker.length);
console.log(callTaker.caller);
console.log(arguments.callee.caller);
console.log(arguments.callee.caller.caller);
console.log(callTaker.name);
console.log(callTaker.constructor);
}
function callMaker(){
callTaker("foo","bar",this,document);
}
function init(){
callMaker();
}
Tengo curiosidad, ¿En qué circunstancias el nombre de la función que está en realidad no la escrita en el código? – bryantsai
@bryantsai: 'ventana [window.prompt ('Nombre de función:', '')] = función() {alerta (arguments.callee.name); }; ' – Boldewyn