Skip to content

Instantly share code, notes, and snippets.

@chrisdothtml
Last active April 29, 2017 20:06
Show Gist options
  • Save chrisdothtml/8877d7dd834f4923f2b689d034046d55 to your computer and use it in GitHub Desktop.
Save chrisdothtml/8877d7dd834f4923f2b689d034046d55 to your computer and use it in GitHub Desktop.
Sample for gist-perf
{
"iterations": 100
}
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]
customForEach(myArr, function (item) {
console.log(item)
})
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