Whenever I console.log() a Backbone.js Collection, Google Chrome's console shows the letter "d" unlike the typical "Object" log-entry in Safari or Firefox. Is there a difference?
Also, whenever I console.log() any sub-item in a Collection (e.g., console.log(exampleCollection.models)), I get an empty array. Am I doing something wrong?
Code:
(function($) {
var Item = Backbone.Model.extend({
defaults: {
"sku":"",
"brand":"",
"model":"",
"picture":"placeholder.jpg"
},
url: function() {
return this.id ? 'products/' + this.id : 'products';
}
});
var Items = Backbone.Collection.extend({
model: Item,
url: "products"
});
var items = new Items;
items.fetch();
console.log(items); // shows "d" in Google Chrome along with typical
// object-like drop-down options
console.log(items.models); // shows "[]" empty array in console
})(jQuery);