-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchaining.js
More file actions
34 lines (29 loc) Β· 867 Bytes
/
chaining.js
File metadata and controls
34 lines (29 loc) Β· 867 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
// Hazrat Ali
// University Of Scholars
// declare variable based on the name of an object property
const myObject = { x: 2, y: 50, z: 600, a: 25, b: 68 };
const { x, b } = myObject;
// console.log('myObject.p', myObject?.p?.q);
// destructuring array
const [p, q] = [45, 37, 91, 86];
// console.log(p, q);
const [best, faltu] = ['momotaj', 'poroshi'];
// console.log(best, faltu);
const { sky, color, money } = { sky: 'blue', soil: 'matti', color: 'red', money: 500 };
//Chaining
const company = {
name: 'GP',
ceo: { id: 1, name: 'ajmol', food: 'fuchka' },
web: {
work: 'website development',
employee: 22,
framework: 'react',
tech: {
first: 'html',
second: 'css',
third: 'js'
}
},
};
console.log(company?.web?.tech?.third);
console.log(company?.backend?.tech.third);