Skip to content

Instantly share code, notes, and snippets.

@JoaoCnh
Last active July 9, 2017 23:12
Show Gist options
  • Save JoaoCnh/12125f8b0309e97eb1871e6bdf67f48c to your computer and use it in GitHub Desktop.
Save JoaoCnh/12125f8b0309e97eb1871e6bdf67f48c to your computer and use it in GitHub Desktop.
js optimized for loop
// normal loop
for (var i = 0; i < array.length; i++) {
console.log(array[i]);
}
// optimized loop
for (var i = array.length - 1; i >= 0; i--) {
console.log(array[i]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment