DEV Community

hema latha
hema latha

Posted on

Javascript Datatypes,Variables, Operators,Conditional statement

Datatypes:
Data types are attributes that define the type of information a variable can store. They are important because they allow computers to understand and process data.

Uses of datatypes:

--> Data types are the language that computers use to understand data.

--> Data types tell the Memory Management Unit how much memory is needed to store data.

JavaScript has 8 Datatypes,

String
Number
Bigint
Boolean
Undefined
Null
Symbol
Object

Variable:
In JavaScript, a variable is a named container that stores values. Variables are used to store and manage data, perform calculations, and make code dynamic.

JavaScript Variables can be declared in 4 ways:

Automatically(Ex: x = 5;)
Using var(Ex: var x = 5;)
Using let(Ex: let x = 5;)
Using const(Ex:const x = 5;)
When to Use var, let, or const?
Always declare variables

Always use const if the value should not be changed

Always use const if the type should not be changed (Arrays and Objects)

Only use let if you can't use const.Let cannot be redeclared but can be reassigned.

Only use var if you MUST support old browsers.Var can be redeclared.

Refer: https://www.w3schools.com/js/js_variables.asp

JavaScript Operators:
Javascript operators are used to perform different types of mathematical and logical computations.

Quadratic AI

Quadratic AI – The Spreadsheet with AI, Code, and Connections

  • AI-Powered Insights: Ask questions in plain English and get instant visualizations
  • Multi-Language Support: Seamlessly switch between Python, SQL, and JavaScript in one workspace
  • Zero Setup Required: Connect to databases or drag-and-drop files straight from your browser
  • Live Collaboration: Work together in real-time, no matter where your team is located
  • Beyond Formulas: Tackle complex analysis that traditional spreadsheets can't handle

Get started for free.

Watch The Demo 📊✨

Top comments (0)

PulumiUP 2025 image

PulumiUP 2025: Cloud Innovation Starts Here

Get inspired by experts at PulumiUP. Discover the latest in platform engineering, IaC, and DevOps. Keynote, demos, panel, and Q&A with Pulumi engineers.

Register Now

👋 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