Check if a variable exists within local scope by name as string?

Viewed 1040

I'd like to find out if there is a variable that exists in the local scope with a given name as a string. Is there way to do something like this?:

var name = 'myVariable';

function test(myVariable) {

     //CHECK HERE if there is a locally scoped variable with the same name
     //as the value of 'name' 

}
2 Answers
Related