• EuphoricPenguin@normalcity.life
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      11 months ago

      If I remember correctly, 0 and 1 are considered falsy and truthy respectively, so it should be falsy and truthy and false which I believe would return false.

      Tried it out to double-check, and the type of the first in the sequence is what ultimately is returned. It would still function the same way if you used it in a conditional, due to truthy/falsy values.

        • EuphoricPenguin@normalcity.life
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          11 months ago

          I was incorrect; the first part of my answer was my initial guess, in which I thought a boolean was returned; this is not explicitly the case. I checked and found what you were saying in the second part of my answer.

          You could use strict equality operators in a conditional to verify types before the main condition, or use Typescript if that’s your thing. Types are cool and great and important for a lot of scenarios (used them both in Java and Python), but I rarely run into issues with the script-level stuff I make in JavaScript.