请老师帮我检查一下错误

来源:4-4 编程练习

weixin_慕粉8004585

2020-03-19 18:39:28

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>数字取整</title>
</head>
<body>
<script>
    //补充代码
    var time = prompt("请输入运动时间");
    var newtime;
    if(isNaN(time))
    { 
        return -1;
    }
    else
    {
        if(time>20)
        {
            newtime = Math.ceil(time);
        }
        else
        {
            newtime = Math.floor(time);
        }
        document.write(time);
    }
</script>
</body>
</html>


写回答

1回答

好帮手慕夭夭

2020-03-19

同学你好,代码的问题与修改如下:

http://img.mukewang.com/climg/5e734ef409e5dade07160418.jpg

如果我的回答帮助到了你,欢迎采纳,祝学习愉快~

0

0 学习 · 40143 问题

查看课程