js把任何值转为布尔值的三种方式

 1. Boolean(value)

 let bn = 3 
 console.log(Boolean(bn)); // true

2.value ? true :false

 console.log(bn?true :false); // true

3.!!value

console.log(!!bn); // true
原文地址:https://www.cnblogs.com/luguankun/p/13742274.html