Search⌘ K
AI Features

Null, Undefined and Symbol

Explore the JavaScript primitive data types null, undefined, and symbol. Understand their meanings and uses, including the intentional absence of values, undefined states, and unique symbol keys.

We'll cover the following...

Null, undefined, and Symbols are primitive types.

Null

Null represents an intentional absence of a primitive or composite value of a defined variable.

Undefined

Undefined represents that a value is not defined.

Symbol

A Symbol() is a unique value without an associated literal value. They are useful as unique keys, because Symbol() == Symbol() is false. At this stage, just accept that symbols exist. You don’t have to use them for anything yet.

Node.js
console.log(null);
console.log(undefined);
console.log(void 0);
console.log(Symbol('ES6 in Practice'));

void is a keyword in Javascript which specifies that the expression next to it will not return anything. You don’t need to worry much about it right now.