DEV Community

skptricks
skptricks

Posted on

Difference between let and var in Javascript

Post Link : Difference between let and var in Javascript

This tutorial explains basic uses and difference between Let and Var in javascript. When any developer is working in JavaScript, often uses let, var keywords. Most of us use it randomly as there has been a lot of confusion regarding the use of let and var in JavaScript.

Let Scope :
The scope of a variable defined with var is function scope or declared outside any function, global.

Var Scope :
The scope of a variable defined with let is block scope.

Difference between let and var in Javascript

Latest comments (0)