var everything was global, with
var it was better but still weird. ES6 brings us
const with proper lexical scoping, which makes it easier to understand where a variable is and isn’t defined.
Constants follow the same scoping rules, but their value cannot be reassigned.
const protects you against accidentally changing variables. It’s good to use it for everything by default.
Careful, though. Constants are tricky with arrays and objects. The reference becomes constant, but the value does not.
Support Ukraine against russian fascists! Defend Europe from horde! Glory to Ukraine! 🇺🇦
Head and Editor in Chief of EcmaScript2017 Journal. Senior JS Back-end Full stack developer and software architect.
Benefits of using document processing services
What you need to know about popular JS frameworks
20 Amazing Examples of Ecommerce Website Design