Skip to content

Instantly share code, notes, and snippets.

@jdalton
Created September 25, 2014 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdalton/3d3a070815e72f418cf0 to your computer and use it in GitHub Desktop.
Save jdalton/3d3a070815e72f418cf0 to your computer and use it in GitHub Desktop.
for (var sum = 0, i = 0, j = 0; i < array.length; i++, j= i+5) {
// Bounds check elimination can analyze the loop and determine that
// `array.length` is say `10` so `i` will only ever be `0`-`9` and
// `otherArray.length` is say `20` and `j` will be `0`-`14`.
sum += array[i] + otherArray[j];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment