Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


in javascript why is 0 equal to false but when tested by if it is not fals


in javascript why is 0 equal to false but when tested by if it is not fals  using -'javascript,boolean'

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

    

asked Sep 10, 2015 by BevKushnerxp
0 votes
45 views



Related Hot Questions



Walkin Jobs Opening



Government Jobs Opening


...