1. Intro - The Common Confusion

Using const with an array feels like it should lock the whole thing in place. Then you try push(), pop(), or update a value, and it still changes. If it’s constant, why is it still changing?

The answer lies in how JavaScript handles variables and references. Once you see that distinction, this behavior becomes far less mysterious and a lot more logical.

2. Binding vs Value — What const Actually Does

A const variable is like a signpost planted firmly in the ground. You can’t move the signpost or point it somewhere else, but whatever it’s pointing at can shift around freely.

Primitives behave like solid stones once placed; they don’t change shape. Arrays and objects are more like workbenches: the signpost stays fixed, but the tools an…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help