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

为什么while(mynum=>0)页面就会崩了

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

</script>

</head>

<body>

</body>

</html>


提问者:平白无聊哎咿呀 2019-08-06 18:35

个回答

  • 慕码人5478227
    2020-12-08 21:13:51

    <script type="text/javascript">

     var mynum =6;//mynum初值化数值为6

    do

    {

    document.write("数字:"+mynum+"<br/>");

    mynum=mynum-1;

    }

    while( mynum>=1      )

    </script>


  • 慕仰7034662
    2019-08-07 15:15:32

    试试(mynum>=0)