Skip to content

Instantly share code, notes, and snippets.

@DavidQL
Created April 9, 2013 18:13
Show Gist options
  • Save DavidQL/5347999 to your computer and use it in GitHub Desktop.
Save DavidQL/5347999 to your computer and use it in GitHub Desktop.
console.time('fast array');
var myClass = function() {
this.array_one = [1,2,3,4,5];
this.array_two = [1,2,3,4,5];
this.total = 0;
}
var my_instance = new myClass();
for (var i=0; i < 4; i++) {
my_instance.total += my_instance.array_one[i];
}
for (var i=0; i < 4; i++) {
my_instance.total += my_instance.array_two[i];
}
console.timeEnd('fast array');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment