4 ms·
I really like the lisp convention of using !'s to indicate mutation. Like set-car! . In javascript you kind of have to reason backwards and declare your variab
by jacobwilliamroy 7y ago
I really like the lisp convention of using !'s to indicate mutation. Like set-car! .
In javascript you kind of have to reason backwards and declare your variables as immutable (const). Though there are still some bugaboos; object fields can still be overwritten even if the object was declared with const.
- bernawil 7y agoconst only means the variable itself can't be reassigned though, and really the main complain about mutation comes from Array methods. Like Array.pop will mutate the array and you have to do an Array.split for the last item instead if you want to keep your array.