EN
JavaScript - get current method reference / currently called method
3
points
In this short article we would like to show how to get currently called method referencje in JavaScript.
Simple solution:
// use inside method / function
var currentMethod = arguments.callee;
Practical example:
// ONLINE-RUNNER:browser;
function a() {
var currentMethod = arguments.callee;
console.log(currentMethod.name);
}
function b() {
var currentMethod = arguments.callee;
console.log(currentMethod.name);
a();
}
b();