Created
June 16, 2014 19:13
-
-
Save ajcrites/61c7924c0ceb54b47580 to your computer and use it in GitHub Desktop.
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 arr = new Array(100000); | |
for (var x = 0; x < arr.length; x++) { | |
arr[x] = 1; | |
} | |
console.time("for"); | |
for (var x = 0; x < arr.length; x++) { | |
console.error(arr[x]); | |
} | |
console.timeEnd("for"); | |
console.time("forEach"); | |
arr.forEach(function (x) { | |
console.error(x); | |
}); | |
console.timeEnd("forEach"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment