为什么可以直接省略掉console.log?

来源:3-19 编程练习

杨子123

2020-08-27 19:59:01

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title></title>

</head>

<body>

<script>

    //预设代码

    var a="50px",

        b="px50",

        c="050px",

        d="50.12345",

        e="50.123px45";

        

        document.write(parseFloat(a)+"</br>");

        document.write(parseFloat(b)+"</br>");

        document.write(parseFloat(c)+"</br>");

        document.write(parseFloat(d)+"</br>");

        document.write(parseFloat(e)+"</br>");

</script>

</body>

</html>


写回答

2回答

6hEd

2020-08-27

document.write() => 页面输出

console.log() => 控制台输出

0

好帮手慕星星

2020-08-28

同学你好,下面同学说的是正确的

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

在两个不同地方输出,而练习中要求在页面中输出,所以只使用document.write()方法即可。

祝学习愉快!

0

0 学习 · 40143 问题

查看课程