Tagged Posts with: dynamic variable

Dynamic Javascript Variables

January 4th, 2009 | Posted in jQuery
1

To create dynamic variables in JavaScript use the eval() function. Of course eval() can be for other dynamic JavaScript creation as well. function dynamic(id) { // Create dynamic variable and set the value eval("var test_" + id + " = \"value goes here\";"); // Return the value return eval("test_" + id); } // Call function ...