filmov
tv
let & const (Block-Scoped Variables) in JavaScript

Показать описание
Introduction
Before ES6 (ECMAScript 2015), JavaScript had only one way to declare variables: var .
However, var had functional scoping issues that led to unpredictable behaviors in certain
cases. To address these problems, ES6 introduced let and const , which provide blocklevel scoping and prevent unintended variable modications.
Before ES6 (ECMAScript 2015), JavaScript had only one way to declare variables: var .
However, var had functional scoping issues that led to unpredictable behaviors in certain
cases. To address these problems, ES6 introduced let and const , which provide blocklevel scoping and prevent unintended variable modications.