javascript - Determine original name of variable after its passed to a function -
I think this may not be possible, but I would like to define the original variable name of a variable Has been passed in a ceremony. I do not know how to explain any better than this, so let's see that this example is understandable.
function getVariableName (unknownVariable) {return unknownVariable.originalName; } GetVariableName (foo); // return string "foo"; GetVariableName (bar); // Return string "bar";
This is for jquery plugin I'm working on, and I want to be able to display the name of the variable which has been passed in a "debug" function.
You are right, in any sensible way this is very impossible, because only the function is in the function is .
Comments
Post a Comment