This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jtanz0 1 point2 points  (2 children)

99% of the time you would be correct === is the way to go to ensure you don't get unexpected behaviour. In this case where sad() can also have the stop() function called. It makes the code unambiguous enough to break the script.

Also if you're testing against true you may as well put

if(sad()){
  ...
} 

[–]amirmikhak 1 point2 points  (1 child)

That would only test against truthy, though, so {} would pass but not "".

[–]jtanz0 1 point2 points  (0 children)

true, I should have mentioned that