Created
May 23, 2014 22:47
-
-
Save estebistec/9d7a1cc12f330140c56b to your computer and use it in GitHub Desktop.
Iterating over an array with extra properties
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
var a = [1,2,3]; | |
a.hasNextPage = false; | |
console.log(a) | |
// [ 1, | |
// 2, | |
// 3, | |
// hasNextPage: false ] | |
// Uh oh... | |
for(k in a) { console.log(k, '=>', a[k]); } | |
// 0 => 1 | |
// 1 => 2 | |
// 2 => 3 | |
// hasNextPage => false | |
// Dammit... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment