使用对象填充数组(在对象中定义)

时间:2013-07-02 18:21:10

标签: javascript arrays object typeerror

我已经停止了一个对象来填充数组并在另一个对象中定义一个数组:

    var ListEntry = function (name, code, order) {
        this.name = name;
        this.code = code;
        this.order = order;
    }

    var myObject = Class.extend({
        list: new Array()
    })

稍后将使用以下数据填充:

    var ListEntry = new ListEntry(cell[0], cell[1], cell[2]);
    this.list.push(ListEntry);

这会抛出一个typeError:ListEntry在尝试创建新对象时不是构造函数。

任何帮助表示赞赏!

1 个答案:

答案 0 :(得分:0)

var listEntry = new ListEntry(cell[0], cell[1], cell[2]);
this.list.push(listEntry);
相关问题