| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/undefined | [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.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.
undefined undefined ,
JavaScript .
function test(t) {
if (t === undefined) {
return "Undefined value!";
}
return t;
}
let x;
console.log(test(x));
// Expected output: "Undefined value!"
Property attributes of undefined | |
|---|---|
undefined . , .
undefined , . .
undefined . undefined . undefined .
:
( ) undefined (undefined ), . .
// DON'T DO THIS
(() => {
const undefined = "foo";
console.log(undefined, typeof undefined); // foo string
})();
((undefined) => {
console.log(undefined, typeof undefined); // foo string
})("foo");
undefinedundefined , . x , if .
let x;
if (x === undefined) {
//
} else {
//
}
:
: x == undefined x null , ( ) .
, . null undefined .
typeof undefined typeof .
let x;
if (typeof x === "undefined") {
//
}
typeof .
// x
// true
if (typeof x === "undefined") {
//
}
// ReferenceError
if (x === undefined) {
}
. JavaScript , .
, in . ,
if ("x" in window) {
// x
}
void undefinedvoid .
let x;
if (x === void 0) {
//
}
// y
if (y === void 0) {
// throws Uncaught ReferenceError: y is not defined
}
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-undefined |
nullThis page was last modified on 2025 10 9 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 |