I would like to join a js variable together with another to create another variable name… so it would be look like;
for (i=1;i<=2;i++){
var marker = new google.maps.Marker({
position:"myLatlng"+i,
map: map,
title:"title"+i,
icon: "image"+i
});
}
and later on I have
myLatlng1=xxxxx;
myLatlng2=xxxxx;
Use the concatenation operator
+, and the fact that numeric types will convert automatically into strings: