Created
November 12, 2017 07:34
-
-
Save agatablue/d5f1399cebf93bdb9a644919fc17233a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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