Q1 변수에 직점 " 변수 = ...array " 하면 오류가 나오는 이유
변수 = ...array //SyntaxError
예상 : ... 을 활용하여 풀어진 요소가 저장소에 들어 갈것을 생각했음
조금생각후 : 변수에 들어갈수 있는 값은 1개 임을 잊어먹음 ㅜㅜ
Q2 매개변수의 숫자를 넘는 인자들을 출력
// TODO 매개변수의 숫자를 넘는 인자들을 출력하고 싶음
function myFun(a, b, ...manyMoreElements) {
console.log("a", a);
console.log("b", b);
console.log("manyMoreElements", manyMoreElements);
}
myFun("one", "two", "three", "four");
/** 예상
* a one
* b two
* ? three
* ? four
*/
/** 결과
* a one
* b two
* manyMoreElements [ 'three', 'four' ]
*/