Rest 파라미터

function myfunction(...rest){
  console.log(rest)
}

myfunction(1, 2, 3, 4, 5, 6, 7)

파라미터를 전부 담은 [1, 2, 3, 4, 5, 6, 7] 이 출력된다.

function myfunction2(a, b, ...rest){
  console.log(rest)
}

myfunction2(1, 2, 3, 4, 5, 6, 7)

이럴땐 a, b인 1, 2를 제외하고 [3, 4, 5, 6, 7]이 출력된다.

rest 파라미터는 가장 뒤에사용해야하고, 중복사용이 불가능하다.