1 <html> 2 <head><title>运算符</title></head> 3 <body> 4 <script> 5 /* 6 //在javascript中字符串连接用 + 号 7 var a=10+15+"tian"+3; 8 //相当于25连接上tian再连接上3 9 alert(a); 10 document.write(a); 11 */ 12 13 //在PHP"" "0" "空格" "0.0" 都表示假 14 //在javascript中""内只要有东西,无论什么都是真。 15 16 if("0"){ 17 alert("真"); 18 }else{ 19 alert("假"); 20 } 21 22 </script> 23 </body> 24 </html>
JavaScript中,对于字符串来说只要引号里面有东西就是真,'0' 就是真。
但对于一般的数字来说,0 还是假。
浙公网安备 33010602011771号