The following shows that "0"
is false in Javascript:
>>> "0" == false
true
>>> false == "0"
true
So why does the following print "ha"
?
>>> if ("0") console.log("ha")
ha
Tables displaying the issue:
and ==
Moral of the story use ===
table generation credit: https://github.com/dorey/JavaScript-Equality-Table