JS why 0=="" will be true

0 is logical false
1 is logical true
empty string is logical false
null is logical false
NaN==anything is false

So:
empty string is logical false, 0 is logical false
false==false The result is true

To achieve the desired result, use ===

Guess you like

Origin blog.csdn.net/lw112190/article/details/107997655