How to get the the variable name from within a function in this example:
// it should return A var A = function(){ console.log(this.name); }
I know this is an old thread, but still in search results. so just for reference:
a solution could simply be using the stacktrace.
var stack = new Error().stack;
use trim and split to get to the desired values.