转换为布尔值
作者:互联网
代表空、否定的值会转换为false , 如 * 、0 、 NaN、null、undefined
其余的值会被转换为true
console.log(Boolean("")); //false console.log(Boolean(0)); //false console.log(Boolean(NaN)); //false console.log(Boolean("null")); //false console.log(Boolean(undefined)); //false console.log(Boolean("小白")); //true console.log(Boolean(12)); //true
标签:console,log,布尔值,undefined,Boolean,false,true,转换 来源: https://www.cnblogs.com/0722tian/p/16081510.html