js中的!一般做取反用
一般取反获得true的有
!null=true
!''=true
!0=true
!undefined=true
!!的用法
正常判断对象a不为空的代码
if(a!=null&&typeof(a)!=undefined&&a!=''){
//a不为空
}
!!处理就简单很多了
if(!!a){
//a不为空
}
js中的!一般做取反用
一般取反获得true的有
!null=true
!''=true
!0=true
!undefined=true
!!的用法
正常判断对象a不为空的代码
if(a!=null&&typeof(a)!=undefined&&a!=''){
//a不为空
}
!!处理就简单很多了
if(!!a){
//a不为空
}