That’s it. That’s the meme.

  • @retrolasered@feddit.uk
    link
    fedilink
    English
    615 days ago

    I genuinely wasn’t aware of that. I must be getting javascript confused for almost any other language. I wonder how many times ive !!'d a value to make that work without actually absorbing that into my head now…

    • @Telemachus93@slrpnk.net
      link
      fedilink
      315 days ago

      In other languages that shouldn’t be equal either though, right?

      Maybe you meant

      if (2){
      console.log("nonzero ints are truthy")
      }
      else {
      console.log("no they're not")
      }
      

      Which would output

      nonzero ints are truthy
      

      and that would actually work in all languages I know. But that’s different from being equal.

    • Excel
      link
      fedilink
      English
      315 days ago

      2 is not == true, but !!2 is true