| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Errors/Undeclared_var | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
ReferenceError: assignment to undeclared variable "x" (Firefox) ReferenceError: "x" is not defined (Chrome) ReferenceError: Variable undefined in strict mode (Edge)
. , var. , , JavaScript .
:
Errors about undeclared variable assignments occur in strict mode code only. In non-strict code, they are silently ignored.
"bar" .
function foo() {
"use strict";
bar = true;
}
foo(); // ReferenceError: assignment to undeclared variable bar
"bar" , var .
function foo() {
"use strict";
var bar = true;
}
foo();
This page was last modified on 7 . 2023 . by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |