loading...

re: Demystifying "const" variables in JavaScript VIEW POST

FULL DISCUSSION
 

I use const all the time. It's very rare that I need let. I can see let being used as an index in a for loop, but I almost never need a for loop. Filter, map and reduce usually do the trick.

 

We're in the same boat! I try to avoid let and even loops, which people think I'm crazy for.

 

Map, Filter and Reduce are loops, but they are immutable for the purpose of us devs.

They're declarative loops, but yes definitely loops.

 

Functional and immutable Js makes code more readable and maintainable imo. I almost exclusively use const, I have yet to find a scenario where I need to change this.

code of conduct - report abuse