Primitive Data Types
These data types are fundamental and immutable, representing basic values directly.
This data type covers both integers and floating-point numbers. Examples:
Strings represent sequences of characters, enclosed in single or double quotes. Examples:
Booleans have two possible values: true or false. They're used for logical operations and conditions. Examples:
When a variable is declared but not assigned a value, it holds the undefined type. Example:
The null type signifies an intentional absence of value. Example:
Symbols are unique and often used as object property identifiers to prevent naming conflicts. Example:
Reference Data Types
These data types are more complex and can hold multiple values and methods. They are mutable, meaning their content can be modified.
Objects are collections of key-value pairs, where keys are strings or symbols and values can be of any data type. Examples:
Arrays are ordered lists of values, indexed starting from zero. They can hold different data types. Examples:
Functions are reusable blocks of code that can be executed when called. Example:
The Date type is used to work with dates and times. Example:
Regular expressions are used for pattern matching within strings. Example: