I'd like a general console.log snippet I can add to all functions without having to type out the function name each time.
function unknownName() {
//psuedo code
console.log(`this function's name: ${_thisFunction_.name}`);
}
Restrictions:
- arguments.callee.name doesn't work in strict mode.
- I don't want to bind every function to be able to use 'this'
- I don't know the function name in advance. Ex (from mozilla.org):
function doSomething() {}
doSomething.name; // "doSomething"