-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdestructuring.js
More file actions
39 lines (34 loc) Β· 1002 Bytes
/
destructuring.js
File metadata and controls
39 lines (34 loc) Β· 1002 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
36
37
38
39
// Hazrat Ali
// University Of Scholars
const fish = { id: 58, name: 'King Hilsha', price: 9000, phone: '01717555555555', address: 'Chandpur', dress: 'silver' };
// const phone = fish.phone;
// const price = fish.price;
// const dress = fish.dress;
// const id = fish.id;
const { phone, price, dress, id } = fish;
// console.log(phone, price);
// console.log(phone, id);
// console.log(phone, dress);
// console.log(phone, price);
// console.log(phone);
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'
}
},
};
// Destructuring
// const work = company.web.work;
// const framework = company.web.framework;
const { work, framework } = company.web;
const { food } = company.ceo;
const { second, third } = company.web.tech;
console.log(work, framework, food);