DEV Community

Cover image for What are the different data types present in JavaScript?
Dhairya Shah
Dhairya Shah

Posted on Edited on Originally published at codewithsnowbit.hashnode.dev

What are the different data types present in JavaScript?

banner

To know the type of the value/variable, we can use the typeof operator

Primitive Types

  • String

A string is represented by the series of characters enclosed by double/single quotes

const name = "SnowBit"
const favLang = "JavaScript"
🏆 Live Soccer TV: dhairyashah/what are the different data types present in javascript e - Info Live Streaming 2026 🏆 Live Soccer TV: dhairyashah/what are the different data types present in javascript e - Info Live Streaming 2026
  • Integer

It represents a number that can be written with or without a decimal

const age = 18
const price = 24.02
🏆 Live Soccer TV: dhairyashah/what are the different data types present in javascript e - Info Live Streaming 2026 🏆 Live Soccer TV: dhairyashah/what are the different data types present in javascript e - Info Live Streaming 2026
  • Boolean

It is a logical entity that has only two values: true and false, basically, booleans are used for conditional operations

const access = true
const isAdmin = false
🏆 Live Soccer TV: dhairyashah/what are the different data types present in javascript e - Info Live Streaming 2026 🏆 Live Soccer TV: dhairyashah/what are the different data types present in javascript e - Info Live Streaming 2026
  • Undefined

When a variable is declared but not assigned, the value of that variable is undefined

  • Null

It represents invalid or non-existent value

const api = null
🏆 Live Soccer TV: dhairyashah/what are the different data types present in javascript e - Info Live Streaming 2026 🏆 Live Soccer TV: dhairyashah/what are the different data types present in javascript e - Info Live Streaming 2026

Thank you for reading, have a nice day!

Cover Photo by Richard Horvath on Unsplash

Top comments (0)