undefined - JavaScript | MDN

developer.mozilla.org

Tin mới

HTML: Markup language

See all HTML references

Date & time formats

See all HTML guides

CSS: Styling language

See all CSS references

See all CSS guides

Centering an element

JavaScript: Scripting language

Standard built-in objects

Expressions & operators

Statements & declarations

See all JavaScript references

Control flow & error handing

Loops and iteration

Working with objects

See all JavaScript guides

Web APIs: Programming interfaces

Service worker API

Using the Web animation API

Using the Fetch API

Working with the History API

Using the Web speech API

All web technology

Progressive web apps

Learn web development

Getting started modules

Structuring content with HTML module

CSS styling basics module

Dynamic scripting with JavaScript module

Border-image generator

Border-radius generator

Box-shadow generator

Color format converter

Equality comparison and sameness

Note: The strict equality operator (as opposed to the loose equality operator) must be used here, because x == undefined also checks whether x is null, while strict equality doesn't. This is because null is not equivalen

typeof operator and undefined

typeof can also determine whether a variable is undefined:

typeof operator and undefined

typeof can also determine whether a variable is undefined:

typeof operator and undefined

typeof can also determine whether a variable is undefined:

temporal dead zone (TDZ)

typeof can also determine whether a variable is undefined:

void operator and undefined

The void operator can also be used to produce the undefined value. This is very commonly seen in minified code because void 0 is 3 bytes shorter and cannot be overridden. You should usually avoid this pattern in your own

JavaScript data types and data structures

Learn how to contribute

This page was last modified on Jan 10, 2026 by MDN contributors.

Expressions and operators

Numbers and strings

Representing dates & times

Regular expressions

Indexed collections

JavaScript typed arrays

Iterators and generators

Resource management