Answer by T.J. Crowder for Dynamic variable name in loop
Since this question is used as a duplicate target:Use an array is good advice if the information you want to access is keyed numerically. If it isn't, you have two options:Use an object and dynamic...
View ArticleAnswer by Jamiec for Dynamic variable name in loop
Well, "Use an array" is undoubtably the right answer here, however if you really want dynamic variables you need to decide the scope of them - the default would be window and then you could do this:var...
View ArticleAnswer by Explosion Pills for Dynamic variable name in loop
Use an array:var marker = [];for (i=0; i < location.length; i++) { marker[counter] = new google.maps.Marker({
View ArticleDynamic variable name in loop
I need to create dynamic variable name in js inside for loopvar counter = 0;for(i=0; i<location.length; i++) { ... var "marker_"+ counter = new google.maps.Marker({But when i expected to have...
View Article
More Pages to Explore .....