I have a javascript variable name defined as lat1. In fact, I have several variables named like such: lat1, lat2, lat3, etc
I want to code a for loop that steps through each lat variable.. and I want to use the for loop index to determine the variable to output...
something like:
var lat1 = "testing";
for (var k = 1; k < 18; k++)
{
var lati = "lat" + k;
var latitude[k] = lati
}
I want latitude[1] to equal "testing"
Is there a syntax I need to use to make lati not text, but actually a pointer to the correct lat1, lat2, etc?
Any help is appreciated
Chris
I want to code a for loop that steps through each lat variable.. and I want to use the for loop index to determine the variable to output...
something like:
var lat1 = "testing";
for (var k = 1; k < 18; k++)
{
var lati = "lat" + k;
var latitude[k] = lati
}
I want latitude[1] to equal "testing"
Is there a syntax I need to use to make lati not text, but actually a pointer to the correct lat1, lat2, etc?
Any help is appreciated
Chris