Josh Comeau 4/24/2023

The “const” Deception

Read Original

This article clarifies the common misconception that variables declared with JavaScript's 'const' keyword are completely immutable. It explains the crucial distinction between assignment (changing what a variable label points to) and mutation (changing the contents of the object itself), using clear examples to show why objects declared with 'const' can have their properties changed.

The “const” Deception

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

2
Designing Design Systems
TkDodo Dominik Dorfmeister 2 votes
4
Introducing RSC Explorer
Dan Abramov 1 votes
6
Fragments Dec 11
Martin Fowler 1 votes
7
Adding Type Hints to my Blog
Daniel Feldroy 1 votes
8
Refactoring English: Month 12
Michael Lynch 1 votes
10