3 ms·
This is useful for the novices among us, especially because it's extremely easy to tell someone "don't use var" and not really follow up on why. But one thing
by TameAntelope 6y ago
This is useful for the novices among us, especially because it's extremely easy to tell someone "don't use var" and not really follow up on why.
But one thing I'd like to know more about is how const and let are handled under the hood (at the engine level). I have some (probably wrong) theories about what happens, but I'd like a comprehensive explanation if anyone has a good link.
- ironmagma 6y agoI'm not sure what happens at the engine level, but also not sure that it matters. As far as I know, Babel translates all `const` and `let` statements to `var` [1]. There's not really any special interpreter functionality required by const because it behaves just like var but with some lexical rules (enforced by the transpiler) and some slight differences in scoping which can also be erased by the transpiler. [1] http://shorturl.at/gAKOU http://shorturl.at/gAKOU