DEV Community

Discussion on: `let` vs `const` and The Mental Mass of Functions

Collapse
 
tobias_salzmann profile image
Tobias Salzmann • Edited

Imho, re-assigning a let with an immutable value should be preferred over mutating a const value though.

Collapse
 
katzy687 profile image
Natti Katz

that's a great point.

The method above is probably more useful with primitives.

In the case where I wanted to slice to a new array, or convert to an immutable data structure I would stick with let.

But the point remains that I wouldn't necessarily want to use let unless that I knew I was going to be doing some reassignment to preserve immutability.