1.for循环
var total=0;
for( var i=1;i<=100;i++){
total+=i;
}
console.log(total);
2.while循环
var i=1;
while(i<=100){
total+=i;
i++;
}
console.log(total);
1.for循环
var total=0;
for( var i=1;i<=100;i++){
total+=i;
}
console.log(total);
2.while循环
var i=1;
while(i<=100){
total+=i;
i++;
}
console.log(total);