I’ve looked for solutions, but couldn’t find any that work.
I have a variable called onlyVideo
.
\"onlyVideo\"
the string gets passe
As far as eval vs. global variable solutions...
I think there are advantages to each but this is really a false dichotomy. If you are paranoid of the global namespace just create a temporary namespace & use the same technique.
var tempNamespace = {};
var myString = "myVarProperty";
tempNamespace[myString] = 5;
Pretty sure you could then access as tempNamespace.myVarProperty (now 5), avoiding using window for storage. (The string could also be put directly into the brackets)