• towerful@programming.dev
      link
      fedilink
      arrow-up
      6
      ·
      4 months ago

      Truthy/falsey refers to how types are converted to booleans.
      So an empty string is falsey. It’s not false, but when compared as a Boolean it converts to false.
      A 0 is falsey, any other number is truthy.

      • Vincent
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        4 months ago

        One pet peeve of mine is testing libraries having toBeTruthy/toBeFalsy matchers, but not toBeTrue and toBeFalse. I get that the latter are no shorter than toBe(true), but if the former are listed in the docs, then people who don’t know the terminology will use those - I’ve seen (past) coworkers do that.