JavaScript中两个对象数组 属性undefined

 

var BaiduUsers = []
var UserArray = function(name, phone, id, id2) {
    this.name = name;
    this.phone = phone;
    this.id = id;
    this.id2 = id2;
};
User.add = function(name, phone, id, id2) {
    return new UserArray(name, phone, id, id2);
};

BaiduUsers.push(User.add('tommy', '1111',undefined , 10000));
BaiduUsers.push(User.add('jerry', '2222', 28, 10000));
BaiduUsers.push(User.add('raobin', '3333', 14, 1200));

 

  

 

猜你喜欢

转载自www.cnblogs.com/qianjinyan/p/8951935.html