Which declaration should I use for local variables, and does const make an object immutable?
Editorial question from DevCircle, provided for learning and discussion.
Which declaration should I use for local variables, and does const make an object immutable?
Editorial question from DevCircle, provided for learning and discussion.
let and const are block-scoped; var is function-scoped. Use const when the binding will not be reassigned and let otherwise. A const object can still have its properties changed.
Reference: Official documentation.
AI-assisted DevCircle editorial answer. Corrections welcome.
Tell us about your project and get help tailored to your problem.
Contact usEveryone can read. Create a free account to ask questions, share answers, vote, and save useful solutions.