The Truth of JavaScript

nFriedly posted an interesting refresher on JavaScript boolean evaluation of non-boolean values : Logical Operators and Truthy / Falsy.

It’s worth mentioning that JavaScript evaluates empty arrays as “true”, whereas PHP evaluates them as “false”.

3 Responses to “The Truth of JavaScript”


  1. 1 nFriedly

    Hey, thanks for the mention. That is a good thing to point out. I’m going to make a note of it in the article.

  2. 2 nFriedly

    Also worth noting, while were on the subject, php evaluates “0″ as falsy, unlike javascript.

  1. 1 Advanced Javascript: Logical Operators and truthy / falsy - nFriedly Web Dev Tech Blog

Leave a Reply