2.2.2 나머지 연산자와 전개 연산자
나머지 연산자 (rest operator)
const [a, ...restArr] = [1, 2, 3, 4];
console.log(restArr); // [2, 3, 4]function normalFunc(p1, p2, ...rest) {
console.log(rest);
}
normalFunc(1, 2, 3, 4); // [3, 4]전개 연산자 (spread operator)
function logThings(a, b, c) {
console.log(a);
console.log(b);
console.log(c);
}
const arr = [1, 2, 3];
logThings(...[1, 2, 3]);Last updated