Variables: let and const
Prefer const when the binding will not change. Use let when you need to reassign. Avoid var in new code.
- const locks the binding (not deep object contents).
- let is block-scoped.
- Always declare before use.
const site = "StudyTonight";
let visits = 0;
visits += 1;
console.log(site, visits);
After you read this chapter, use Write (when available) and Quiz on this page to lock it in.