-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpgFive.js
More file actions
35 lines (32 loc) · 909 Bytes
/
pgFive.js
File metadata and controls
35 lines (32 loc) · 909 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
33
34
35
const titleFive = "///////////// THIS IS PAGE FIVE /////////////";
console.log(titleFive);
// Object Literals - key value pairs
const character = {
firstName: "Scooby",
lastName: "Doo",
age: 4,
hobbies: ["eating", "sleeping", "scared"],
address: {
street: "50 main st",
city: "Chicago",
state: "MA",
},
};
console.log(character);
console.log(character.firstName);
console.log(character.lastName, character.age);
console.log(character.hobbies[0]);
console.log(character.address.state);
//destructuring - creating variables
// think of pulling these out of the Object.
// like one cookie out of the jar at a time.
const {
firstName,
lastName,
address: { city },
} = character;
console.log(firstName);
console.log(city);
// directly adding a property - uncomment to add an email to the character array.
// character.email = "scoob@mysterymachine.com";
// console.log(character);