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
var james = { | |
job: "programmer", | |
married: false, | |
sayJob: function() { | |
console.log("Hi, I work as a " + james.job); | |
} | |
}; | |
// james' first job |
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); |