• kameecoding@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    1 year ago

    yes, that is a solid logic, one that I also applied and expected to be the result.

    that is until a Vue component started complaining that I am passing in a number for a prop that expects a boolean.

    turns out the result of that code is actually: 0, because javascript

    of course if you flip it and try

    false && 0 && 1

    then you get false, because that’s what you really want in a language, where && behaves differently depending on what is on what side.

    • EuphoricPenguin@normalcity.life
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year 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.