Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
엄격 모드(strict mode)에서만 발생하는 ReferenceError 경고.
선언되지 않은 변수로 값은 할당되었습니다. var 키워드가 없이 할당이 된 것입니다. 선언된 변수와 선언되지 않은 변수 사이에는 차이가 있는데, 이는 예상치 못한 결과를 가져오며, 때문에 JavaScript 엄격모드에서는 에러를 발생시키고 있습니다.
선언된 변수와 선언되지 않은 변수에 대하여 기억해야 할 세 가지:
더 많은 설명과 예제를 필요로 한다면 이 var 참조문서 페이지를 보세요.
선언되지 않은 변수 할당에 대한 에러는 엄격 모드(strict mode code)에서만 발생합니다. 비-엄격 코드에서는 조용히 묵인됩니다.
이런 경우에는, 변수 "bar"는 선언되지 않은 변수가 됩니다.
"bar" 를 선언된 변수로 만들기 위해서, var 키워드를 변수명 앞에 붙여줍니다.
This page was last modified on 2023년 7월 18일 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.