June 2018
Beginner
288 pages
6h 31m
English
We saw that JavaScript has three options to define variables: var, let, and const. When writing new code or refactoring existing code, take some time to replace the old way of declaring with var with the modern replacements let or const.
Here are a few rules to follow when working with variables:
In the industry, many developers tend to lean toward let and often assume that const may not be an option. For instance, when writing a for loop, consider whether const is suitable instead of let.
const is the go to keyword to define variables and let should be more of an exception. There are many benefits to using const instead of let:
Read now
Unlock full access