DEV Community

Discussion on: When to use LET or CONST

Collapse
 
curtisfenner profile image
Curtis Fenner

1) If you use TypeScript (and there's really not much reason not to anymore), changing the type is something the compiler will reject -- the problem of not knowing the type of a variable is not a problem of assignment but the lack of static analysis in JavaScript.

2) mutating objects is filled with danger, because you don't know who else has a handle on the object. Invoking immutable/pure functions will necessitate assignment in loops.

Thread Thread
 
matscode profile image
Michael Akanji

I see where you are coming from...

You have 2 points. :-D

It seems to appear like we have a common point.

However, here, the post is just about pure JS.

It's been nice debating with you.. :raise-hand: