4 ms·
For JavaScript const is more for letting the developer know intent. If I declare a local variable within a function with const, I am saying this variable should
by crysin 7y ago
For JavaScript const is more for letting the developer know intent. If I declare a local variable within a function with const, I am saying this variable should not be reassigned. If I use let I am saying that the variable can be reassigned.
It's nice when looking at someone else's code and being able to tell if they intended to have a variable be reassignable or not.
Maybe you've talked to JavaScript devs who are just bad at explaining their reasoning or maybe they just strictly adhere to linters which encourage the use of const and let and throw linting errors when they come across a var.
Either way, I'd recommend you reevaluate your language and refrain from calling other dev's weenies just for having a different opinion than yours and maybe not being able to properly explain their stance. Using language that borders bullying is not helpful, it's no better than calling someone a snowflake or other degrading term.