강의

멘토링

커뮤니티

Inflearn Community Q&A

sywes9043's profile image
sywes9043

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 함수 스코프에서 선언해야만 하는지 모르겠습니다.

javascript

Answer 1

0

zerocho님의 프로필 이미지
zerocho
Instructor

전역스코프에 선언하면 그 값이 바뀌지 않기 때문입니다. 한 번 해보세요.

sywes9043's profile image
sywes9043

asked

Ask a question