问答详情
源自:4-7 来来回回(Do...while循环)

为啥他老是无响应

<!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>


提问者:五趾的鱼 2017-03-29 14:35

个回答

  • 慕粉4171047
    2017-03-29 14:43:08
    已采纳

    循环里是减法,mynum越来越小,while里的条件一定成立,就成死循环了,应该是while(mynum>=1)

  • qq_慕沐9321514
    2019-05-15 16:34:17

    munum-1改成mynum+1就行了

  • qq_杨康乐_0
    2017-03-29 15:02:43

    mynum++就对了

  • qq_晴天娃娃_15
    2017-03-29 14:45:48

    死循环