Skip to content

Instantly share code, notes, and snippets.

@daihuaye
Created October 17, 2014 15:57
Show Gist options
  • Save daihuaye/da0eb75e86cb70c25bd6 to your computer and use it in GitHub Desktop.
Save daihuaye/da0eb75e86cb70c25bd6 to your computer and use it in GitHub Desktop.
Loops can get terribly slow in JavaScript.
var names = ['George',
'Ringo',
'Paul',
'John'];
for(var i=0,j=names.length;i<j;i++){
doSomethingWith(names[i]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment