javascript if(条件)------------条件中可以使用的值

1、布尔变量true/false
2、数字非0,非NaN/ (0 或NaN)

NaN--------Not a Number

3、对象非null/(null或undefined
4、字符串非空串("")/空串("")

红色的部分返回、false

不用写一大堆if(str!=null && str!=undefined && str !=''), 只要用一句if(str)就可以了

原文地址:https://www.cnblogs.com/sallet/p/4091620.html