标签:
var i = 10; var a = i++; // i = i + 1; alert(a);
alert ( 10 > 5 ); var i = 100; var n = 100; alert(i == n); alert(i != n); alert(i === n)
&&:逻辑与
||:逻辑或
!:逻辑非
var i = 8; //outputs false alert ( i<5 && i<10); //outputs true alert(!(10 > 5)); //outputs false
语法:
if(condition) statements1 else statement2
例:
if(10 > 5) { alert(“hello world”); } var i = 90; if(i > 100) { alert(i + “大于100”); }else if(i > 80) { alert(i + “大于80”); }else{ alert(i + “小于100”); }
语法:
switch (expression){ case value: //statement break; case value: //statement break; default: //statement }
例:
var i = 25; switch(i){ case 25: alert(i + "等于 25"); break; case 100: alert(100); break; default: alert(‘other’); }
标签:
原文地址:http://www.cnblogs.com/tori/p/5835751.html