This way I could have a function that says whatever_way_you_do_this = something. Is this possible? Basically I could tell a function which variable I want to set by giving it a string that holds the name of the variable.
Thanks
If it is a global variable named myVar
, you can use:
window["myVar"]
You can use
eval(variableString);
Proceed with caution as many don't recommend using eval()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With