var vs let
introduction to the `let` keyword for declaring block-scoped variables; and the dangers of scoping, such as the temporal dead zone
Variables declared with var
have function scope. This means that they are accessible inside the function/block they are defined in. Take a look at the following code:
Get hands-on with 1400+ tech skills courses.