1. 7
  1.  

  2. 7

    now we only have to wait for the 20% article that takes 80% of the time ;)

    1. 2

      In JavaScript you’d use const most of the time because it’s immutable.

      This is wrong. The whole problem with const in JS is that it is mutable.

      1. 4

        To be fair, JS is not unique in this — const has advisory or even aspirational status in some other languages, too.

        1. 1

          It does conflate reassignment with mutation, but the convention is nevertheless a common one, regardless of whether one agrees with it.

          1. 1

            Well, I think that rule is dumb because it leads to the misunderstanding that this article perpetuates. But whether prefering const is good or bad, it is very important to state explicitly that const in JS is not immutable. It is mutable but not reassignable. JS has Object.freeze which actually does create immutable objects.