Created
April 27, 2016 12:38
-
-
Save omgmog/8b3e4144b65f6d310e197a47e2da5e73 to your computer and use it in GitHub Desktop.
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 arr = []; | |
arr[100] = 'Foo'; | |
// Outputs lots of 'undefined' and then the value for arr[100] | |
for (var i=0;i<arr.length;i++) { | |
console.log(arr[i]); | |
} | |
// Outputs just the indexes with a value defined | |
for (var item in arr) { | |
console.log(item); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment