Every variable has a data type. Data type indicates what kind of data the variable holds. In JavaScript, the type of data variable hold can be grouped into two categories:
JavaScript supports five primitive data types:
From these basic data types, more complex data type (also known as composite types) is derived. Although JavaScript supports five primitive data types, we actually use only numbers, strings, and Booleans to store data. The undefined and null types arise under certain circumstances in programming.
From primitive types mentioned above, we can derive composite types. A composite type can consist of numbers, strings, Booleans, undefined and null values. The three types of composite types available in JavaScript are objects, arrays, and functions.