티스토리 뷰

🌈 JavaScript

Destructuring assignment

James Wetzel 2024. 11. 30. 15:36
728x90
반응형

Destructuring assignment(구조 분할 활당)

let a, b, rest;
[a, b] = [10, 20];

console.log(a);
// Expected output: 10

console.log(b);
// Expected output: 20

[a, b, ...rest] = [10, 20, 30, 40, 50];

console.log(rest);
// Expected output: Array [30, 40, 50]
728x90
반응형