반응형
Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
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
Archives
Today
Total
관리 메뉴

taenyLog

[JavaScript] Destructuring 배열 분해 본문

Web

[JavaScript] Destructuring 배열 분해

taenyLog 2023. 9. 26. 10:57
반응형

DESTRUCTURING 

A short, clean syntax to 'unpack' : 

- Values from arrays

- Properties from objects

Into distinct variables. 

 

 

Array

const scores = [100, 98, 90 ,88, 53, 33];

const highScore = scores[0];
const secondHighScore = score[1];

const [gold, silver] = scores

> gold
< 100

> silver
< 98

 

 

반응형