for(var i=0i<10i++) {
console.log("Hello World")
}
var i = 0var huaidan = "我是坏蛋!!"
while (i <10){
alert(huaidan)
i += 1
}
// 1 for循环for (i=1i<=100i++){ alert (i)}
//2 while循环
var i=1
while (i<=100){
alert(i)
i++
}
//3 do while 循环
var i = 1
do{
alert(i
i++
}while(i <= 100)
//for in 和 forEach 用于数组的循环遍历
//4 for in
var arr1=[1,2,3,4,5,6,...99,100]
for (i in arr1){
alert (i)
}
//5 foreach
var arr1=[1,2,3,4,5,6,...99,100]
arr1.forEach(function(i){ alert(i)})