!!"123" 相当于是 Boolean("123") //结果为true
!!{a:1} 相当于是 Boolean({a:1}) //结果为true
if
语句中,表达式的结果将被强制为布尔值,通过双重否定(!!
)或强制转换为布尔值Boolean
是不必要的。Redundant double negation.eslint(no-extra-boolean-cast)
原文:https://www.cnblogs.com/baiyifengyun/p/13547834.html