I'd like to create a function wich have a var in argument, if the var is defined return the var value else return the var name
I try
test = function(variable){
try{
if ( typeof(variable) != "undefined" ) {
return 'true'
}
return 'false'
}catch(e){
console.log(e);
}
}
but if I have an undefined var the function isn't called and I have the undefined function error.
I would like to know how to have the variable name too
Thanks :)