JavaScript has several built-in data types, including:
Number
(this represents a numerical value, either an
integer or a floating-point number. For example, 1, 2.5, and -10 are all
numbers.)
String
(this represents a sequence of characters, enclosed
in single or double quotes. For example, "hello world" and 'JavaScript'
are strings.)
Boolean
(this represents a logical value that can be either
true or false.)
BigInt
(for very large integers)Symbol
(for unique identifiers)undefined
(a variable that hasn't been assigned a value)
null
(a missing object)Object
(the root of every other JavaScript type, this data
type represents a collection of properties and values)
JavaScript types can be divided into two categories - primitive types and object types (see Primitive vs Reference Types ).
JavaScript's primitive types include numbers, strings and booleans.
The special JavaScript values null
and
undefined
are primitive values, but they are not numbers,
strings, or booleans.
ES6 added a new special-purpose type, known as Symbol
.
One of the newest features of JavaScript is a new numeric type known as
BigInt
. BigInt is a numeric type whose values are integers.
The type was added to JavaScript mainly to allow the representation of
64-bit integers.
Any JavaScript value that is not a number, a string, a boolean, a symbol,
null, or undefined is an Object
.
An object is a collection of properties where each property has a name and a value.
An ordinary JavaScript object is an unordered collection of named values. The language also defines a special kind of object, known as an array, that represents an ordered collection of numbered values.