我在使用backbone.js 时遇到了一些问题。虽然我所有的代码都有效,但我确实得到了一个例外: 
 TypeError: 'undefined' is not an object (evaluating '(e=this.models[c]).cid').
当模型数量超过限制时会发生异常,我在集合中调用 self.remove() 。
var Column = Backbone.Collection.extend({
    initialize: function(col) {
        var view = new ColumnView({
            id: "column_" + col.id,
            column: col
        });
        view.render();
    },
    comparator: function(tweet) {
        return tweet.get('created_at_time');
    },
    clean: function() {
        var self        = this;
        var total       = this.models.length;
        var threshold   = (total - window.config.threshold) - 1;
        if(threshold > 0) {
            console.log("Removing if tweet is older then " + threshold);
            this.models.forEach(function(tweet, index) {
                if(index < threshold) {
                    self.remove(tweet);
                }
            });
        }
    }
});
有谁知道发生了什么?错误发生在 safari 上。