Is it possible to see the callee/caller of a function when use strict
is enabled?
It does not worked for me Here is what I finally do, just in case it helps someone
function callerName() {
try {
throw new Error();
}
catch (e) {
try {
return e.stack.split('at ')[3].split(' ')[0];
} catch (e) {
return '';
}
}
}
function currentFunction(){
let whoCallMe = callerName();
console.log(whoCallMe);
}