I'm new to BackboneJS. I'm trying to build a model and view, understanding how they work as I build them.
If I create my model like this:
const VideoViewerModel = Backbone.Model.extend({
defaults: {
video: '',
title: '',
description: ''
}
})
const videoModel = new VideoViewerModel;
I get get this in my console:
videoModel.attributes
{video: '', title: '', description: ''}
But I I create it like this:
const VideoViewerModel = Backbone.Model.extend({
defaults: function () {
return {
video: '',
title: '',
description: ''
}
}
})
const videoModel = new VideoViewerModel;
I get this in my console:
videoModel.attributes
{}
Why am I getting two different results?