Geolocation, Loop With For And Javascript
I'm working on a Geolocation tool for a mobile website and so far i got this: The Geolocation verification from here: if (navigator.geolocation) { navigator.geolocation.getCurr
Solution 1:
Your loop condition is i<4
so i
will be 0, 1, 2, 3
, but you only have array indices 0, 1, 2
You can't go past the length of the array, so change the loop condition to go until the length of the array using i < aLocal.length
for(i = 0; i < aLocal.length; i++) {
Solution 2:
aLocal
has three elements. Your loop goes from 0 to 3 so that are 4 elements.
for (var $i = 0; $i < aLocal.length; $i++) {
//...
}
Post a Comment for "Geolocation, Loop With For And Javascript"