Skip to content

将任意类型转为Boolean的方案 ​

1.Boolean函数 ​

js
Boolean('') // false
Boolean(1) // true

2.取反两次 ​

js
!!'' // false

上次更新于: