rest, spread
const slime = { name: '슬라임', attribute: 'cute', color: 'red'};이 있다고 하자. name 속성을 비구조화 할당하고 나머지는 others에 저장하려면 어떻게 할까? const { name, ...other } = slime; slime속성에 추가로 height: 180을 가지는 객체 tall_slime를 만들려면 어떻게 할까? const tall_slime = { ...slime, height: 180}; const numbers = [0,1,2,3,4];이 있다고 하자. 0,1을 one,two 변수에 담고 나머지는 others에 저장하려면 어떻게 할까? const [one, two, ...others] = numbers; numbers가 두번 반복하는 [0..
2020. 6. 28.