07 Aug 2024 • 1 min read
In every Javascript app I've worked on, the linter has enforced preference towards const
over let
. And yet I've always wondered why code like this is valid Javascript:
const user = {
id: 1234;
}
user.id = 4567;
This lightning talk by Ryan Florence finally made it click–const
doesn't create true immutability! It just makes it feel like the code is immutable.
Get my posts in your feed of choice. Opt-out any time.
If you enjoyed this article, you might enjoy one of these: