js the '0' in the end is true or false

 

  IF ( '0') alert ( " '0' to true IS");
  IF ( '0' == to false) alert ( " '0' to false IS"); As a result, the two are alert! Then the '0' in the end it is true or false?

The answer is: js comparison, when there is this three rules:
If you have two boolean comparison, the boolean will be converted to the corresponding number, namely 0 and 1 (false is 0, 1 is true)
if the comparison one of the two sides of one of them is for the number string, string will be converted to a digital
string to be converted directly boolean when empty string '' is converted to false, in addition to all other character string into true

 

Guess you like

Origin www.cnblogs.com/wjx6270/p/11818378.html