asked
[Renewal] Introduction to JavaScript in Zero Seconds through Coding Self-Study
Decide if the word is correct
Written on
·
436
0
영상 내 5분 56초에
const order = Number($order.textContent);
를 왜 전역 스코프가 아닌 onClickButton 함수 스코프에서 선언해야만 하는지 모르겠습니다.
Answer 1
전역스코프에 선언하면 그 값이 바뀌지 않기 때문입니다. 한 번 해보세요.