SOURCE

//for
var sum1 = 0;
for (var i = 0; i <= 100; i++) 
{
    sum1 += i;
}
document.write(sum1);
document.write("<br/>");

//while
var sum2 = 0;
var i = 0;
while (i <= 99) 
{
    i++;
    sum2 += i;
}
document.write(sum2);
document.write("<br/>");

//do-while
var sum3 = 0;
var i = 0;
do 
{
    i++;
    sum3 += i;
}
while (i <= 99);
document.write(sum3)
console 命令行工具 X clear

                    
>
console