Var, let, and const, what's the difference | freeCodeCamp

var is globally scoped and hoisted, which can lead to unintended side effects. let is block-scoped and can never be redeclared within that scope – much harder to break, but need to be careful about passing it to where it's needed and aware that it is still hoisted, albeit with no value (not even null). const works similarly to let, but you cannot update the value (though you can update internal values).

Explore Other Notes

Newer

The React cheatsheet for 2020

A very hand overview of the core concepts in React, from JSX to fragments to hooks. Includes quick reference to the core hooks and how/when to use them e.g. useState, useContext, useMemo …

  • <!DOCTYPE html> <html> <head> <title></title> </head> <body> <p>var is globally scoped and hoisted, which can lead to unintended side effects. let is block-scoped and can never be redeclared within that scope – much harder to break, but need to be careful about …</p> </body> </html>
  • Murray Adcock.
Journal permalink