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

15 Answers
15

Leave a Reply

Your email address will not be published. Required fields are marked *