Skip to main content

Command Palette

Search for a command to run...

What are the different data types present in JavaScript?

Published
•1 min read
What are the different data types present in JavaScript?
D

I am 17 years old and a young passionate and self-taught frontend web developer and have an intention to become a successful developer. I usually write about JavaScript and Web Development and share some tips in the articles.

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"
  • Integer

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

const age = 18
const price = 24.02
  • 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
  • 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

Thank you for reading, have a nice day!

Cover Photo by Richard Horvath on Unsplash

10 views

More from this blog

D

Dhairya Shah

119 posts

What are the different data types present in JavaScript?