Skip to content

Instantly share code, notes, and snippets.

@agatablue
Created November 12, 2017 07:34
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 agatablue/d5f1399cebf93bdb9a644919fc17233a to your computer and use it in GitHub Desktop.
Save agatablue/d5f1399cebf93bdb9a644919fc17233a to your computer and use it in GitHub Desktop.
function Cat(name) {
this.name = name;
}
Cat.prototype.getVoice = function() {
console.log("Miau miau");
};
Cat.prototype.catFeet = 4;
var numberOfCats = 1000000;
var arrayOfCats = [];
for(var i = 0; i < numberOfCats; i++) {
arrayOfCats.push( new Cat("kitty" + i) )
}
arrayOfCats[56].getVoice() // Miau miau
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment