JS - var, let & const in 30 seconds #shorts

preview_player
Показать описание
Var is almost never used in modern javascript since es6 (ES2015) when let and const was introduced. A good strategy is to use const as much as you can. Look into the immutability pattern.
Let variables can be updated but not re-declared. Const variables can neither be updated nor re-declared. Const Arrays and Objects can be mutated however.
Let can be declared without being initialized. Const must be initialized during declaration.
Let and const are block scoped. A block scope is the area within if, switch conditions or for and while loops. Generally speaking, whenever you see curly brackets. { }

Рекомендации по теме
Комментарии
Автор

Plz turn down the volume of beat dude🙂 can't hear u properly

contraspower
Автор

It many all case use let! So mut easier

cozynipples