美文网首页
构造函数<创建函数>

构造函数<创建函数>

作者: 宋咯咯 | 来源:发表于2017-11-14 20:34 被阅读0次

    function teacher (name,age,type){

        this.name = name;

        this.age = age;

        this.type = type;

    }

    var student ={

        name:"zhangsan",

        age : 20,

        hobby :["体育","阅读","游戏"]

    }

    alert(student.name);

    alert(student.hobby);

    alert(student.teacher.name); 

    相关文章

      网友评论

          本文标题:构造函数<创建函数>

          本文链接:https://www.haomeiwen.com/subject/npmxvxtx.html