I am trying to place if statements inside of a function with conditions based on the NAME of the parameter used in the function, not the value.
What conditions can be used to achieve this? Is it possible? If not, is there and alternative?
For example:
var lorem="The name is Lorem, but the value isn't.";
var ipsum="The name is Ipsum, but the value isn't.";
//the values shouldn't matter
logIt(Lorem);
function LogIt(theName){
if(**the name of the variable theName = "lorem"**){
console.log("The variable 'lorem' was used.");
}else if(**the name of the variable theName = "ipsome"**){
console.log("The variable 'ipsum' was used.");
}else{
console.log("huh?");
}
}