Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 881 Bytes

File metadata and controls

17 lines (15 loc) · 881 Bytes

There are 8 basic data types in JavaScript.

1. number for numbers of any kind: integer or floating-point, integers are limited by ±(253-1). 2. bigint is for integer numbers of arbitrary length. 3. string for strings. A string may have zero or more characters, there’s no separate single-character type. 4. boolean for true/false. 5. null for unknown values – a standalone type that has a single value null. 6. undefined for unassigned values – a standalone type that has a single value undefined. 7. object for more complex data structures. 8. symbol for unique identifiers. 9. The typeof operator allows us to see which type is stored in a variable.

Two forms: typeof x or typeof(x).

Returns a string with the name of the type, like "string". For null returns "object" – this is an error in the language, it’s not actually an object.