Skip to content

Instantly share code, notes, and snippets.

@stevencombs
Created September 24, 2013 21:51
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 stevencombs/6691808 to your computer and use it in GitHub Desktop.
Save stevencombs/6691808 to your computer and use it in GitHub Desktop.
// 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