In loosely-typed languages, it's often useful to use === (strict equality operator) rather than == (equality operator), because otherwise the types of objects will be coerced during the equality check.
For example, "0" == 0
, and "" == 0
, and [] == 0
.
However, none of those === 0
.
So if results
happened to be an object with an empty property length
, like so:
var results = {
length: ""
}
results.length == 0
would still evaluate to true
.