View Single Post
Old 09-04-2012, 08:37 PM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,261
Thanks: 10
Thanked 533 Times in 527 Posts
devnull69 will become famous soon enough
Maybe it will help you if you realize that every variable name in the global scope is automatically the key of an associative array called "window" if you use it as a string

i.e.
Code:
var myVar = 5;
alert(window["myVar"]);  // will give 5

window["myNewVar"] = "Hello";
alert(myNewVar);   // will give "Hello"
So you could do it like this
Code:
window[array[0]] = array[1];
devnull69 is offline   Reply With Quote