Created
September 24, 2013 21:51
-
-
Save stevencombs/6691808 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
// Javascript Getting Started with Programming | |
// A Codecademy Javascript (Loop the loop) assignment | |
// Dr. Steven B. Combs, coding novice | |
// Person constructor | |
function Person(name,age) { | |
this.name=name; | |
this.age=age; | |
} | |
// Now we can make an array of people | |
var family= [ | |
new Person("alice",40), | |
new Person("bob", 42), | |
new Person("michelle",8), | |
new Person("timmy", 6), | |
]; | |
// loop through array and output to console | |
for (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