3 ms·
Javascript only enforces reassignments to const. So this, const arr = [] arr.push(“grape nuts”] is just peachy in JS and requires the programmer to avoid
by filoeleven 1y ago
Javascript only enforces reassignments to const. So this,
const arr = []
arr.push(“grape nuts”]
is just peachy in JS and requires the programmer to avoid using it.
More importantly, because working immutably in JS is not enforced, trying to use it consistently either limits which libraries you can use and/or requires you to wrap them to isolate their side effects. ImmerJS can help a lot here, since immutability is its whole jam. I’d rather work in a language where I get these basic benefits by default, though.
- throwaway2037 1y ago> Javascript only enforces reassignments to const. Java is the same with the keyword final. I never heard anyone complain about it. Are you asking for the special hell that is C++ const correctness?