Skip to content

Instantly share code, notes, and snippets.

@dlueth
Last active January 2, 2018 15:25
Show Gist options
  • Save dlueth/5773416 to your computer and use it in GitHub Desktop.
Save dlueth/5773416 to your computer and use it in GitHub Desktop.
JavaScript: Best practice "for i" loop
var values = [ 'entry 1', 'entry 2', 'entry 3' ], i, value;
for(i = 0; (value = entry[i]) !== undefined; i++) {
// do whatever you want in here :)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment