//1.while循环 var i = 1; var sum1 = 0; while(i<=100){ sum1 = sum1 + i; i++; } document.write(sum1+"<br/>"); //2.for循环 var i = 1; var sum2 = 0; for(;i<=100;i++){ sum2 = sum2 + i; } document.write(sum2+"<br/>"); //3.do-while循环 function sum3(){ var result = 0; var i=0; do{ i++; result +=i; } while(i<=99) return result } document.write(sum3());