var vs let vs const, and why you should almost never use var again.
var vs let vs const, and why you should almost never use var again. var is function scoped and can be redeclared. It also gets hoisted, which means you can reference it before you declared it and get undefined instead of an error. That is the source of some genuinely confusing bugs. let is block scoped. It exists only inside the braces it was declared in, and it can be…








