Data types

A data type is a classification that specifies which type of value a variable has and what type of operations can be applied to it.

The main data types are string, number, boolean, null (primitive data type), and objects (reference data type).

Strings are a collection of characters (letters, numbers, spaces, symbols, etc.) within a double quote “”.

302

Numbers are any integer or decimal number created in the language. If it’s a decimal number, we use a decimal point (not a comma).

292

Booleans are true or false values. Used to say if something is true or false (only 2 possible values).

292

Null represents an empty value, the intentional absence of a value, or lack of value because it hasn't been assigned yet (it doesn't exist).

In Expression language, null is used instead of JavaScript's undefined.

294

Objects are collections of related data. An object contains properties, defined as a key-value pair. A property key (name) is always a string, but the value can be any data type, like strings, numbers, booleans, or complex data types like arrays, function and other objects.


What’s Next