
Data types in JavaScript
27 August, 2022
0
0
0
Contributors
1.
2.
3.
4.
5.
6.
7.
typeof
operator. Data type of a variable can be checked by using the typeof
operator as shown in the code belowBoolean
true
and false
. See the code below for better understanding.String
Undefined
Null
Null datatype cannot be identified using typeof
operator. If a variable containing a null value is passed to a typeof
operator it will return object as output.
Symbol
Number

If you want to check which if a value can be stored as a number data type, the following refrences could be useful:
Number.MAX_SAFE_INTEGER
is the the largest integer value that number can storeNumber.MIN_SAFE_INTEGER
is the smallest integer that number can store.Number.MAX_VALUE
is the largest positive floating point value that number can store.Number.MIN_VALUE
is the smallest floating point value that number can store.- Number.MIN_VALUE
is the largest negative floating point value that number can store.- Number.MAX_VALUE
is the smallest negative floating point value that number can store.
BigInt
n
. See code below for better understanding.