Skip to content

Instantly share code, notes, and snippets.

@colinvh
Last active August 29, 2015 14:15
Show Gist options
  • Save colinvh/651f55bcffb3aa35519e to your computer and use it in GitHub Desktop.
Save colinvh/651f55bcffb3aa35519e to your computer and use it in GitHub Desktop.

A

for (init; check; update) {
	...
}

B

init;
while(check) {
	...
	update;
}

A and B are the same.

If thing is an Array

A

for (var i in thing)

B

for (var i = 0; i < thing.length; i++)

A and B are the same.

Normal for-loop usage

for (var i = start; i <= end; i++)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment