Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created July 7, 2016 03:20
Show Gist options
  • Save codecademydev/321c5e9a67dc9cd493458296a9816b4c to your computer and use it in GitHub Desktop.
Save codecademydev/321c5e9a67dc9cd493458296a9816b4c to your computer and use it in GitHub Desktop.
Codecademy export
// 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);
// add the last family member, "timmy", who is 6 years old
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment