true 为非 0 数,false 为 0。 null返回false。
a&&b 相当于:
if(a){
if(b){
return 1;
}else{
return 0;
}
}else{
return 0;
}
a || b 相当于:
if(a){
return 1;
}else{
if(b){
return 1;
}else{
return 0;
}
}