// swipe
let a = 10
let b = 20
[a, b] = [b, a];
console.log(a, b) // 20 10
key값으로 매칭 !
let obj = { one: 1, two: 2, three:3 }
let { one, two, three } = obj
console.log(one, two, three) // 1, 2, 3
// 다른 이름으로 할당받기
let { one:hi, two, three } = obj
console.log(hi, two, three) // 1, 2, 3
// 기본값 할당
let { one:hi, two, three, abc=4 } = obj
console.log(hi, two, three, abc) // 1, 2, 3, 4
let obj = {
name: "포도",
age: 12,
hobby: "eating",
};
let { name: myname, age, hobby, etc = "hi" } = obj;
console.log(myname, age, hobby, etc);
const func = ({ name, age, hobby }) => {
console.log(name, age, hobby);
};
func(obj);