자바스크립트 함수에는 arguments라는 객체가 존재한다
arguments is an Array-like object accessible inside functions that contains the values of the arguments passed to that function.
source:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments
arguments는 배열같은 객체로써 함수안에서 접근이 가능하다.
function printArguments() {
// arguments 객체의 요소들을 하나씩 출력
for (const arg of arguments) {
console.log(arg);
}
}
printArguments('Lebron', 'Curry', 'KD');