Two object array properties are undefined in JavaScript

 

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));

 

  

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324930646&siteId=291194637