-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter1.js
More file actions
32 lines (28 loc) · 859 Bytes
/
Copy pathchapter1.js
File metadata and controls
32 lines (28 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*var david = {
first_name: "David",
last_name: "Durr"
};
var student1 = {
id: "1234",
courses: ["Programming I", "English II", "Algebra"],
advised: false
};
console.log(david.last_name); // displays "Durr"
console.log(student1["id"]); // displays "1234"
console.log(student1.courses[1]); displays "English II"
student1.advised = true;
david.age = 50;*/
function Person(first, middle, last) {
this.first = first;
this.middle = middle;
this.last = last;
this.initials = initials;
}
function initials() {
return this.first[0] + this.middle[0] + this.last[0];
}
var aPerson = new Person("John","Quincy","Public");
console.log("First name: " + aPerson.first);
console.log("Middle name: " + aPerson.middle);
console.log("Last name: " + aPerson.last);
console.log("Initials: " + aPerson.initials());