Difference between var, let and const in JAVASCRIPT?

Posted by

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOps School!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Var

The var is a keyword that is used to declare a variable,We can declare a variable again even if it has been defined previously in the same scope.

syntax

var name = value;

let

The let is also a keyword that is used to declare a variable, We cannot declare a variable more than once if we defined that previously in the same scope.

syntax

let name = value;

Const

The value of a constant can’t be changed through reassignment (i.e. by using the assignment operator), and it can’t be redeclared 

syntax

const VARIABLE_NAME = value;

guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x