I know if you want to check if a variable a
is defined you can do this
if (typeof a !== 'undefined') {
// the variable is defined
}
but what if you want to make a function out of it, like this
function checkDefined(name) {
return typeof name !== 'undefined';
}
checkDefined("a");
this wouldn't work, but how can I get it to work if I have to pass a string version of the variable name?
Thanks