Skip to content

Null

Technically null is not a data type. It represents a variable with no value.


Syntax

To create a new variable and set it to null:

1
var myData = null;

To create a variable of a different type and then change it to null:

1
2
var myData = "This variable will begin as a string data-type";
myData = null;

To delete a null variable:

1
delete myData;

Properties

A property is a special feature of a variable that can be used to get and/or set some aspect of that variable.

type

The type property can be used to find out the data-type of a particular null variable. The result will always be "null"

1
var result = myData.type;

Functions

There are no functions specific to null variables