美文网首页
创建对象

创建对象

作者: 在下高姓 | 来源:发表于2020-05-14 18:02 被阅读0次

    var a = function(){ //自定义类型函数a
    this.x = 1; //属性x
    this.y = 2; //属性y
    };
    var b = new a; //创建对象
    console.log(a.x); //调用对象属性x,返回1

    相关文章

      网友评论

          本文标题:创建对象

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