Created
March 15, 2016 05:28
-
-
Save JasonDeving/fc55b16f3879f3aeea9e to your computer and use it in GitHub Desktop.
Iterating arrays
This file contains 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
var box = [] | |
box['size'] = 9; | |
box['0'] = 'meow'; | |
for (var k in box){ | |
console.log(k); | |
// prints out property names | |
} | |
for (var k in box){ | |
console.log(box[k]); | |
// the values | |
} | |
for (var k in box){ | |
console.log(box.k); | |
// undefined | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment