Let say I got a string with the name of the variable I want to create.
If I want to create it with a global scope, I'd use window["myString"] = 100;
or global["myString"] = 100;
on Nodejs.
Is there a way to do the same but create the variable with local scope? (Ex: Inside a function)
EDIT: Note: The goal is to access the variable with its name directly. Ex: myString
I already know that I could easily create a object that would have the value as an attribute. Ex: obj.myString
. But this is not what I'm looking for.