Last active
April 29, 2017 20:06
-
-
Save chrisdothtml/8877d7dd834f4923f2b689d034046d55 to your computer and use it in GitHub Desktop.
Sample for gist-perf
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
{ | |
"iterations": 100 | |
} |
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
function customForEach (arr, iterator) { | |
var index | |
for (index = 0; index < arr.length; index++) { | |
iterator(arr[index]) | |
} | |
} | |
window.customForEach = customForEach | |
window.myArr = [1, 2, 3, 4, 5] |
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
customForEach(myArr, function (item) { | |
console.log(item) | |
}) |
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
myArr.forEach(function (item) { | |
console.log(item) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment