Data Types in JavaScript

VariablesType Conversion

Every value in JavaScript has a data type. Understanding types is essential for writing correct and predictable code.

JavaScript has two main categories: primitive types (immutable basic values) and objects (complex, mutable data).

Primitive Types

There are seven primitive data types:

  • String – text values
  • Number – integers and floating-point numbers
  • Boolean – true or false
  • Undefined – variable declared but not assigned
  • Null – intentional absence of value
  • Symbol – unique identifiers (ES6)
  • BigInt – arbitrary-precision integers (ES2020)

String

Number

JavaScript has one number type for both integers and floats.

Boolean

Undefined and Null

Symbol and BigInt

Objects

Everything else (arrays, functions, dates, etc.) is an object.

Checking Types with typeof

Quick Quiz

We have reviewed and checked the materials, but errors may still occur. The content is provided for educational purposes only, so use it at your own responsibility and verify with other sources if needed.

✨ Ask Lara — your AI study partner

Unlock personalized learning support. Lara can explain lessons, summarize topics, and answer your study questions — available from the Go plan and above.


Lara helps you learn faster — exclusive to ReadyTools Go, Plus, and Max members.

Track Your Progress 🚀

Learn more easily by tracking your progress completely for free.