switch,for循环语句的使用
//while循环:先判断条件,再执行循环 /* var sum = 0; var i = 1; while(i <= 10 ) { alert("刚进循环时候:"+ sum +","+i); sum = sum + i; i++; alert("循环执行之后:"+ sum +","+i); } alert(sum);*/ // do-while循环:循环体内的代码,至少执行一次 /* var sum1 = 0; var j = 1; do { sum1 =sum1 + j; j++; }while (j <= 10); alert(sum1);*/ //for 循环 /* var sum2 = 0; var biao = 0; for (var i = 0; i <= 10;i++) { sum2 = sum2 + i; biao++;//语句执行的次数 } alert(biao);*/