//arguments
function 함수1(a, b, c) {
console.log(arguments); //모든 파라미터를 []안에 넣은 변수
}
함수1(1, 2, 3);
function 함수더하기(a, b, c) {
let total = 0;
for (var i = 0; i < arguments.length; i++) {
console.log(total = total + arguments[i]);
}
}
함수더하기(1, 4, 2);
Spread,rest 파마미터 (0) | 2021.08.26 |
---|---|
함수 arguments 말고 rest 파라미터 (0) | 2021.08.25 |
Sread Operator / 펼침연산자 활용 (0) | 2021.08.24 |
자바스크립트가 문자 다루는 신기한 방법 (Template literals) (0) | 2021.08.23 |
물리엔진 js Matter.js (0) | 2021.08.13 |