DEV Community

abdulganiyy
abdulganiyy

Posted on • Edited on

2

Data Types In JavaScript

In JavaScript, there are seven data types. Six data types are primitive and one is non primitive.

PRIMITIVE DATA TYPES

  1. Number: This can be integers, decimal or floating point numbers.There are also special numbers namely; Infinity and NaN. Infinity is gotten by division with zero and NaN is as a result of incorrect mathematical operation.

  2. Strings: They represent textual data. Strings can be a single character or combination of different characters. Single quotes, double quotes begin and end strings e.g 'sugarcrush' or "sugarcrush".

  3. Boolean: Boolean values can either be True or False. A truthy value simply means yes and a falsy value means no.

  4. Null: When a null value is assigned to a variable in JavaScript, this denotes that the value is not in existence.

  5. Undefined: When a value of undefined is assigned to a variable, this denotes that a value has not been assigned to it. We can also define an undefined value by just declaring a variable without assigning it to any value or explicitly giving it a value of undefined.

  6. Symbol: Symbols are unique identifiers in JavaScript.symbol is created using Symbol() and every value created using this is unique.

NON-PRIMTIVE

Objects are the only non primitive data types in JavaScript. They are used to store key-value pairs collection of items. Objects store complex entities. It can store all the data types discussed above.

Stay tuned for more tutorials...

Quickstart image

Django MongoDB Backend Quickstart! A Step-by-Step Tutorial

Get up and running with the new Django MongoDB Backend Python library! This tutorial covers creating a Django application, connecting it to MongoDB Atlas, performing CRUD operations, and configuring the Django admin for MongoDB.

Watch full video →

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.

Neon image

Next.js applications: Set up a Neon project in seconds

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Get started →

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, cherished by the supportive DEV Community. Coders of every background are encouraged to bring their perspectives and bolster our collective wisdom.

A sincere “thank you” often brightens someone’s day—share yours in the comments below!

On DEV, the act of sharing knowledge eases our journey and forges stronger community ties. Found value in this? A quick thank-you to the author can make a world of difference.

Okay