Datatypes

JavaScript datatypes are the classifications of data used in programming to define the nature of values. They include:

  1. Primitive Data Types: These are basic data types that are immutable (unchangeable) and directly hold values. They include:
  2. Number: Represents numeric values like integers and floating-point numbers.
  3. String: Represents textual data enclosed within single or double quotes.
  4. Boolean: Represents true or false values.
  5. Undefined: Represents a variable that has been declared but not assigned a value.
  6. Null: Represents the absence of any value or object.
  7. Symbol (added in ECMAScript 6): Represents a unique identifier.

Composite Data Types: These are data types that can hold multiple values and are mutable (changeable). They include:

  1. Object: Represents a collection of key-value pairs where values can be of any datatype, including other objects, functions, and arrays.
  2. Array: Represents a list-like collection of elements, each identified by an index starting from 0.

Understanding these datatypes is crucial for effectively managing data and performing operations in JavaScript programs.

Join our accountability group

Learn JavaScript with a supportive community of web designers and developers
Join knowcode