Created
June 22, 2017 15:32
-
-
Save lossness/5f3ee26865b7d99a91afdb7b0517a217 to your computer and use it in GitHub Desktop.
trying to print each persons name to console in order
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
// Our Person constructor | |
function Person(name, age) { | |
this.name = name; | |
this.age = age; | |
} | |
// Now we can make an array of people | |
var family = new Array(); { | |
family[0] = new Person("alice", 40); | |
family[1] = new Person("bob", 42); | |
family[2] = new Person("michelle", 8); | |
family[3] = new Person("timmy", 6); | |
} | |
for (var i = 0; i < family.length; i++); { | |
console.log(family[i].name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment