Why is the item variable undefined in this Backbone example?
var Action = Backbone.Model.extend({
defaults: {
"selected": false,
"name": "First Action",
"targetDate": "10-04-2014"
}
});
var Actions = Backbone.Collection.extend({
model: Action
});
var actionCollection = new Actions( [new Action(), new Action(), new Action(), new Action()]);
_.each(actionCollection, function(item) {
alert(item);
});
jsFiddle here: http://jsfiddle.net/netroworx/KLYL9/