[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Errors/Undeclared_var [Back]  [Original]

ReferenceError: assignment to undeclared variable "x" - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

ReferenceError: assignment to undeclared variable "x"

    ReferenceError: assignment to undeclared variable "x" (Firefox)
    ReferenceError: "x" is not defined (Chrome)
    ReferenceError: Variable undefined in strict mode (Edge)

In this article

(strict mode) ReferenceError .

?

. var . , , JavaScript .

:

  • . .
  • . .
  • ( ) . . ( .)

var .

(strict mode code) . - .

, "bar" .

js
function foo() {
  "use strict";
  bar = true;
}
foo(); // ReferenceError: assignment to undeclared variable bar

"bar" , var .

js
function foo() {
  "use strict";
  var bar = true;
}
foo();


Web Proxy Viewer  |  New URL  |  Original Page