Get the current function name in JavaScript
This should do it:
var fn = arguments.callee.toString().match(/function\s+([^\s\(]+)/);
alert(fn[1]);
For the caller, just use caller.toString()
.
alert(arguments.callee.nom);
alert(arguments.callee.name)