How do I maintain access to the i variable inside my for loop below? I\'m trying to learn, not just get the answer, so a bit of explanation would be very helpfu
i
for (var i = 0; i < statesPolyStrings.length; i++) { (function(i){ google.maps.event.addDomListener(document.getElementById(statesPolyStrings[i]), 'mouseover', function() { $("#"+statesPolyStrings[i]).addClass("highlight"); statesPolyObjects[i].setOptions({ strokeWeight: '2' }); }); })(i) }