ES6: When to use var, let and const keywords in java script?

Опубликовано: 19 Август 2022
на канале: TheCodeTale
80
7

Difference between var, let and const keywords in js.
var keyword is function scoped and is the oldest way to declare variables in javascipt.
let was introduced in ES6, let and const are block scoped variables and they can not be accessed outside the block in which they are declared.
It is possible to reclare the same variable with var keyword but that is not the case with let and const keywords.