JS - var, let & const in 30 seconds #shorts
Barely Coding with Daniel Bark
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. { }
Twitter: https://twitter.com/BarelyDaniel Github: https://github.com/danba340 ... https://www.youtube.com/watch?v=v8hOi2oIAK0
1191241 Bytes