spread와 rest
spread와 rest
spread
객체나 배열에서 중복된 부분을 퍼트릴 때
함수를 호출 할 때 인수로 전달할 값을 퍼트릴 때
예제 1.
const toy = {
type: "bear",
price: 15000,
};
const blueToy = {
...toy,
color: "blue",
};
const yellowToy = {
...toy,
color: "yellow",
};
console.log(blueToy...
woodstock.hashnode.dev2 min read