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.

Jan 23, 2025 - 06:44
 0
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.

What's Your Reaction?

like

dislike

love

funny

angry

sad

wow