Lets say I have an array of names for a variable:
var varNames = new Array("name1","name2","name3");
How do I create var name1, var name2 and var name3 by just looping through the varNames array?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This will create global variables (in the global namespace, i.e.
window).Since using global variables is considered bad practice, you could create variables within a custum object:
[ES20xx]