SOURCE

//1 .for循环
var result = 0;
for (var i = 0; i <= 100; i++) {
result += i;
}

document.write(result);
document.write("<br />");

//2. while()循环
var result2 = 0;
var i = 0;
while (i <= 99) {
i++;
result2 += i;
}

document.write(result2);
document.write("<br />");


// do-while语句
var result3 = 0;
var i = 0;
do {
i++;
result3 += i;
}
while (i <= 99);

document.write(result3)
console 命令行工具 X clear

                    
>
console