https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
//할당, 나머지 할당
let [a, b, ...rest] = [1, 2, 3, 4, 5];
console.log(a); //1
console.log(b); //2
console.log(rest); //[3, 4, 5]
//값 맞바꾸기
[a, b] = [b, a];
console.log(a); //2
console.log(b); //1
//객체로 새 변수에 값 할당하기
let { a: aa = 1, b: bb = 2 } = { a: 3};
console.log(a); //Uncaught ReferenceError: a is not defined
console.log(aa); //3
console.log(bb); //2
//객체 쪼개기?
let {a, b, ...rest} = { a: 1, b: 2, c: 3, d: 4};
console.log(a); //1
console.log(b); //2
console.log(rest); //{ c:3, d: 4 }