Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pgainda/5535169 to your computer and use it in GitHub Desktop.
Save pgainda/5535169 to your computer and use it in GitHub Desktop.
To increase i by more than just one, use i += number. However, you can't use i + number for this. The increase won't be saved back into i. i will always be the starting value and never satisfy the second loop parameter. This will make the loop run forever and crash your browser
var i;
for (i = 2; i <= 6; i+=2) {
console.log(i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment