JavaScript with Mozilla extensions has both function-scoped vars and block-scoped lets. Along with hoisting and dynamic behavior, scope in JavaScript is sometimes surprising. var function-scoped hoist to the top of its function redeclarations of the same name in the same scope are no-ops const function-scoped hoist to the top of its function redeclarations of the same name in the same scope are re
![Scope Cheatsheet - Archive of obsolete content | MDN](https://cdn-ak-scissors.b.st-hatena.com/image/square/2fe94e9b9c9eb1072ab266138db7f8db3ae22b6b/height=288;version=1;width=512/https%3A%2F%2Fcdn.mdn.mozilla.net%2Fstatic%2Fimg%2Fopengraph-logo.72382e605ce3.png)