10 Matching Annotations
  1. Apr 2023
  2. Aug 2022
    1. It's often a good idea to replace common primitives, such as strings, with appropriate value objects.
  3. Jul 2022
    1. It made sense when JS was doing small simple things in HTML - it doesn’t make much sense anymore

      No, it still makes sense.

      Insisting that everyone use === everywhere, on the other hands, makes as much sense as disallowing method declarations that accept a parameter that implements an interface (in favor of formal parameters that insist on a certain class or a derivative), or injecting a bunch of instanceof checks for no good reason...

    2. I have rarely encountered a good reason to use == in JS. Most of the time, or you are relying on it, you are probably doing something wrong.
    3. Easier to just add a new operator that does things the right way and keep the original == operator as is. That way people can transition on their own time

      Stupid myth.

  4. May 2022
    1. typeof v === "number"

      Using triple equals to check the results of typeof is totally unnecessary, and a sure sign that someone, somewhere has unthinkingly adopted some dubious advice; it's a code smell/red flag.

      A standard equality comparison (using ==) does exactly the right thing while also avoiding association with questions/doubts about the quality of the surrounding code.

  5. Mar 2022