求解释一下这个也能输出6个数字!!
求解释一下这个代码也能输出6个数字:
<!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 )
</script>
</head>
<body>
</body>
</html>
输出:
数字:6
数字:5
数字:4
数字:3
数字:2
数字:1