Skip to content

Commit 8a98058

Browse files
authored
Update Assign-To-New-Variable.js
1 parent 99cb7f7 commit 8a98058

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Assign-To-New-Variable.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11

22
// Assignment To A New Variable
33

4+
// Object:
45
const mhs = {
5-
nama: 'Godam Perkasa',
6+
nama: 'Godam Hero',
67
umur: 33
78
}
89

10+
// Destructuring:
911
const {nama, umur} = mhs;
10-
console.log(nama);
12+
console.log(nama); // output: 33
13+
console.log(umur); // output: Godam Hero
1114

15+
// Assign to new variable:
1216
const {nama: n, umur: u} = mhs;
17+
18+
// Result:
1319
console.log(u); // Output: 33
20+
console.log(n); // Output: Godam Hero
21+
1422

1523

0 commit comments

Comments
 (0)