구조 분해 할당
구조 분해 할당
구조 분해 할당(destructuring assgiment)는 ES6에서 새롭게 추가된 문법이다. 비 구조화 할당이라고도 부른다.
배열 구조 분해
const arr = [10, 20, 30];
const [a, b, c] = arr;
console.log(a);//10
console.log(b);//20
console.log(c);//30

객체 구조 분해
const monster = {
no : 25,
name : "피카츄",
type : "전기"
};
const {no, name} = monster;
console.log(no);//25
console.log(name);//피카츄

Last updated