五趾的鱼
2017-03-29 14:35
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>do...while</title>
<script type="text/javascript">
var mynum =6;//mynum初值化数值为6
do
{
document.write("数字:"+mynum+"<br/>");
mynum=mynum-1;
}
while(mynum<=10)
</script>
</head>
<body>
</body>
</html>
循环里是减法,mynum越来越小,while里的条件一定成立,就成死循环了,应该是while(mynum>=1)
munum-1改成mynum+1就行了
mynum++就对了
死循环
JavaScript进阶篇
468191 学习 · 21891 问题
相似问题