Hacker News new | past | comments | ask | show | jobs | submit
I knew this in and out, but as a Full-Stack PHP/Symfony/Frontend/JS guy who pivoted to mainly TS for b2b stuff, I still have to occasionally enter

  !""

into the browser console just to be sure, during code reviews :D
In JS/TS:

    "0" == false : true
    ""  == false : true
    " " == false : true
    "1" == false : false

    !"0" : false
    !"" : true
    !" " : false
    !"1" : false

In PHP:

    "0" == false : true
    ""  == false : true
    " " == false : true
    "1" == false : false

    !"0" : true
    !"" : true
    !" " : false
    !"1" : false
Honestly the only way to remain sane in either, but especially if you use both, is to always use === and never use boolean logic (!) when a string could be involved.
loading story #48249678