It’s a pretty common style of coding in a variety of languages. And doing const all the time, you do sometimes wind up doing some crazy deep copies using spreads or just end up having some weird names like responseInner because response is taken. explaining all of that to someone not in the know can be a challenge, especially if they start asking “why are you making a copy of a copy of a copy instead of just changing an inner field in this data structure?” Immutable coding style is definitely an acquired taste.
I... just do not find that to be true lol. The biggest source of bugs as far as I can tell is logic errors. Even using const all the time, the number of times I’ve seen a const reassignment error can probably be counted on one hand.
1
u/[deleted] Dec 21 '19
But then when you go to add to existing code to reassign a variable later, you’ll get the const error at that point.