Difference between var, let and const in JAVASCRIPT?

Posted by

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