Created
June 13, 2013 19:16
-
-
Save gavinblair/5776514 to your computer and use it in GitHub Desktop.
I have a bunch of loops, for different arrays. I just need some counters. When I do this, jshint says my variables k and l are already defined. Should I move on to other letters of the alphabet? Is there a better way?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(var k in myarray){ | |
for(var l in myarray[k]){ | |
//do something with myarray[k][l] | |
} | |
} | |
for(var k in someotherarray){ | |
for(var l in someotherarray[k]){ | |
//do something with someotherarray[k][l] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're over-thinking it, you just can't declare the variable every time: