Datatypes are used to hold different types of values. JavaScript supports the following three primitive datatypes.
- Numbers – It can be a whole number of a fractional number.
- String – A string is used to hold a series of characters.
- Boolean – Boolean datatype can hold only two values – TRUE or FALSE.
Things to remember
- Strings are written inside double or single quotes.
- Integers are written without a single or double quote.
- JavaScript treats all numbers as 64-bit floating-point values.
Following is a list of JavaScript datatypes.
Datatype | Type |
String | Primitive |
Number | Primitive |
Boolean | Primitive |
Object | Composite |