loading...

re: Demystifying "const" variables in JavaScript VIEW POST

FULL DISCUSSION
 

Thanks for the post. I use const only for constants in top-level scope like const URL = 'https://example.com'.
For other scenarios I prefer to use let. It's just annoying to change const to let every time you need to make a variable mutable.

This post by TC39 committee member Jamie Kyle is rude, but resonates with my view on let vs const battle.

 

Thanks for sharing that post.

I'm not sure I can fully agree with Kyle. Most of his points are fair, but the main goal of const is to communicate intention. Yes if I didn't reassign my variable, then I intend on it not to change. Later on when I come back and want to change it that's fine, I just know that it's not being changed currently so I can be more aware of that.

 

Agreed, that post misses the point.

Why am I not surprised that someone like that is on the language committee? (I'd say JS culture is basically worse is better, but somehow its movers and shakers manage to screw up even that up.)

code of conduct - report abuse