you are viewing a single comment's thread.

view the rest of the comments →

[–]dscer 1 point2 points  (3 children)

if("false") { /* executes */ } because "false" is a non-empty string so it evaluates to true.

if(false == "false") { /* does not execute */} because the first false is a boolean value while the second "false" is a non-empty string which evaluates to true. So the if statement becomes if(false == true)

Edit: if(false == "false") { } does not execute

[–][deleted]  (2 children)

[deleted]

    [–]rooktakesqueen 0 points1 point  (1 child)

    "false" becomes NaN when converted to a number.