- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnestedObjectExample.js
More file actions
Latest commit
34 lines (33 loc) · 837 Bytes
/
Copy pathnestedObjectExample.js
File metadata and controls
34 lines (33 loc) · 837 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
letspaceship={
passengers : [{name: 'Space Dog'}],
telescope : {
yearBuilt: 2018,
model: "91031-XLT",
focalLength: 2032
},
crew: {
captain: {
name: 'Sandra',
degree: 'Computer Engineering',
encourageTeam(){console.log('We got this!')},
'favorite foods': ['cookies','cakes','candy','spinach']}
},
engine: {
model: "Nimbus2000"
},
nanoelectronics: {
computer: {
terabytes: 100,
monitors: "HD"
},
'back-up': {
battery: "Lithium",
terabytes: 50
}
}
};
letcapFave=spaceship.crew.captain['favorite foods'][0];
letfirstPassenger=spaceship.passengers[0];
console.log(capFave)
console.log(firstPassenger)
console.log(spaceship.crew.captain.encourageTeam())