日期:2014-05-16 浏览次数:20360 次
alert(!false);//true alert(!true);//false alert(!null);//true alert(!undefined);//true alert(!"");//true alert(!"abc");//false alert(!{});//false alert(!function(){});//false alert(!0);//true alert(!NaN);//true alert(!Infinity);//false alert(!123);//false
alert(5+5);//10 alert("the sum of 5 and 5 is :"+(5+5));//the sum of 5 and 5 is :10 alert(5+"5");//55 alert("the sum of 5 and 5 is :"+5+5);//the sum of 5 and 5 is :55
alert(8-true);//7,true自动转为1 alert(NaN-1);//NaN,只要有一个操作数为NaN,结果为NaN alert(5-4);//1 alert(5-"");//5,""自动转为0 alert(5-"2");//4,"2"自动转为1 alert(5-null);//5,null自动转为0