第11次作业-利用构造函数创建对象

这个作业属于哪个课程 https://edu.cnblogs.com/campus/sdscfz/SF3
这个作业要求在哪里 https://edu.cnblogs.com/campus/sdscfz/SF3/homework/12975
这个作业的目标 第11次作业-利用构造函数创建对象
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- <input name="按钮" type="button" onClick="clic()" value="按钮"></input> -->
    <button ondblclick="document.write(student1.name+student1.age+student1.hobby+student1.gender+str)">按钮</button>
    <script>

        function Stu(name,age,hobby,gender){
            this.name = name;
            this.age = age;
            this.hobby = hobby; 
            this.gender = gender;
           
        }

        var now = new Date()
            var str = 
        now.toLocaleDateString() + ' ' +
        now.toLocaleTimeString();

        var student1 = new Stu('高晨',18,'女','玩游戏听音乐');
        // document.write(student1.name+student1.age+student1.sex+student1.love+str)

    

    </script>
</body>
</html>


posted @ 2023-05-17 14:48  蘸醋荷兰猪  阅读(16)  评论(0编辑  收藏  举报