baidu_ctrl_CV
2022-10-15 11:46
<!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>break</title>
<script type="text/JavaScript">
var mynum =new Array(70,80,66,90,50,100,89);//定义数组mynum并赋值
var i=0;
while(i<mynum.length)
{
if(mynum[i]<60)
{
document.write("成绩"+mynum[i]+"不及格,不用循环了"+"<br>");
break;
}
document.write("成绩:"+mynum[i]+"及格,继续循环"+"<br>");
i++;
}
</script>
</head>
<body>
</body>
</html>
当然可以而且看起来感觉简洁
JavaScript进阶篇
468194 学习 · 21891 问题
相似问题