Question · JavaScript and TypeScript course · Module 2: Functions, Arrays and Objects
Variable Optimization
Why should you use const instead of let when the variable's value won't change?
Answer options
- const automatically optimizes memory
- const signals immutability intent and prevents accidental reassignment
- const allows using the variable before declaration
- const is faster to execute
Show the answer
Correct answer:
- const signals immutability intent and prevents accidental reassignment