Undefined / Null

Get hands-on experience on how to use undefined values or null as a JavaScript data type.

Undefined values

When you declare a variable, its value is initialized to whatever value you assign by using the = sign. The following code snippet will initialize the variable as pi a number.

Press + to interact
var pi = 3.14159265359;

But what if we created a variable that didn’t assign any ...