7-2编程这样做对吗?

来源:7-2 编程练习

慕粉13657933304

2018-08-31 21:43:29

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>Document</title>

</head>

<body>

    <script>  

        //补充代码

        function animal(){

            this.name='狗狗';

            this.foot='食物';

            this.say=function(){

                alert(this.name+"喜欢吃"+this.foot)

            }

        }

        function dog(){

            animal.call(this,',');

        }

        var c= new dog();

        c.say();

    </script> 

</body>

</html>


写回答

1回答

樱桃小胖子

2018-09-02

您好,效果是可以的,继续加油!

0

0 学习 · 4826 问题

查看课程