-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02_nested_obj.js
More file actions
34 lines (32 loc) · 852 Bytes
/
Copy path02_nested_obj.js
File metadata and controls
34 lines (32 loc) · 852 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
// nested object
const newHobby = ['run', 'basket', 'football'];
const notRandom = 'Dumpak dug dug deeerrr';
const john = {
firstName: 'john',
status: {
married: false,
student: true,
},
skills: {
technology: {
webdesign: ['html', 'css', 'figma', 'javascript'],
backend: ['nodejs', 'django'],
},
},
hobby: {
manga: {
read: ['onepiece', 'sololeveling'],
sport: newHobby,
},
},
randomhere: notRandom,
};
// access
console.log(john.status.married); //false
console.log(john.status.skills); //undefined
console.log(
john.skills.technology.webdesign[john.skills.technology.webdesign.length - 1]
); //javascript
console.log(john.hobby.manga.read); //['onepiece', 'sololeveling'];
console.log(john.hobby.manga.sport); //[ 'run', 'basket', 'football' ]
console.log(john.randomhere); //random