"Well this isn't going to be a controversial post" he said, wrongly.
For those unaware, the title is in reference to a little discussion that span...
For further actions, you may consider blocking this person and/or reporting abuse
Same here.
By default, I write
const
and then only switch tolet
if I need to change a variable. If you write code functional programming style (which is better IMO), you won't be usinglet
. I almost don't uselet
at all.I don't use JS as my main language, but I've been using it since corduroy was cool and that wasn't obvious to me.
Nice post. I'm still a newbie learner, so I'll have to google some things, but overall this made sense. I've been a bit confused over this, and I think a lot of courses on Udemy are teaching let over const, but from the viewpoint of skimming code and expecting a change with let, that makes a lot of sense. Gonna bookmark this post and come back to it when I pick up JS again. Thanks.
I'm glad you found my post so helpful!
As an aside, my posts are usually aimed at people who already know quite a bit, but I try to also add some language for people who are new, but extra curious.
The fact that you still understood it means a lot to me!
I used to think like you. Then I started working in an environment where I'm about the only real front-end developer and the others are repurposed WinForms developers. You don't want to know how many times I get the question why their const can be mutated.
So, yes, in theory you're right. In some environments, however, prefer-let makes more sense. I'm all for changing your approach based on your environment and/or project instead of thinking in absolutes.
Very interesting article, I always wanted to know which way should I use. I can make my opinion now, thank you !
Thanks for the article. Interesting.
If you combine let and const you left ~10% of users with broken code.
For Backend is Ok whatsoever.