Data Types

Data Types: The Building Blocks

JavaScript has different types of data, just like we have different types of things in real life – numbers, text, true/false statements, and more. Understanding these types helps you work with data correctly.

Primitive Data Types

  • String: Text data (words, sentences)
  • Number: Numbers (integers and decimals)
  • Boolean: True or false values
  • Undefined: Variable declared but no value assigned
  • Null: Intentionally empty value
  • Symbol: Unique identifier (advanced)
  • BigInt: Very large numbers (advanced)

Reference Data Types

  • Object: Collection of key-value pairs
  • Array: Ordered list of values
  • Function: Reusable block of code

Checking Data Types

Copy to Clipboard

Tip: Use typeof to check what type of data you’re working with!