Skip to content

Commit b505d3c

Browse files
authored
Create Destructuring-Array.html
1 parent f607be6 commit b505d3c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Destructuring-Array.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
// Destructuring Array - by using []
3+
4+
<p>Outputnya: <b><span id="demo"></span></b></p>
5+
6+
<script>
7+
8+
const perkenalan = ['Halo', 'nama', 'saya', 'Godam Jaya'];
9+
10+
const [salam, satu, dua, nama] = perkenalan;
11+
12+
console.log(salam); // output: Halo
13+
console.log(dua); // output: saya
14+
15+
document.getElementById("demo1").innerHTML = dua;
16+
17+
// HTML output:
18+
// Outputnya: saya
19+
20+
</script>

0 commit comments

Comments
 (0)