<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<script>
/*while(0){
alert('while')
}
do{
alert(1)
}while(0)
*/
count =1
/*while(count<=10){
alert(count)
count++
}
*/
/*
count =11
do {
alert(count)
++count
}while(count<=10)
*/
//while(1){
//
// if(count>10){
// break;
// }
// alert(count)
// count++
//}
//
//alert('while wai')
for(count =0 ;count<10;count+=3)
{
if(count<8)
{
continue;
}
alert(count)
}
</script>
</body>
</html>
continue break 在循环结构中的使用 for while do while
最新推荐文章于 2025-09-28 20:44:01 发布
本文通过一个具体的JavaScript脚本示例介绍了不同类型的循环控制结构,包括while循环、do...while循环以及for循环,并展示了如何使用break和continue来改变循环的执行流程。

1076

被折叠的 条评论
为什么被折叠?



