Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch 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



Government Jobs Opening


...