<script>
function test1(obj){
if(obj){
alert("has obj");
}else{
alert("has not obj");
}
}
test1();//has not obj
test1(null);//has not obj
test1(undefined);//has not obj
test1("");//has not obj
test1(0);//has not obj
test1(" ");//has obj
test1("1");//has obj
test1(3);//has obj
test1(-2);//has obj
</script>
总结:不传参数,传的参数为null或undefined或**""或0**的时候if(obj)不成立,反之则成立