I\'m new to JS and Backbone
What\'s the difference between these two?
TestModel = new Backbone.Model({ title: \"test title\" })
TestModel = Backbone.
In the second case TestModel is a contructor which you can use several times later to create an instance of model:
var model = new TestModel();
However passing title to extend has a different meaning. You should probably use:
var TestModel = Backbone.Model.extend({defaults: { title: "test title" }});
or pass the model attributes when creating an object:
var model = new TestModel({ title: "test title" });
In the first case on the other hand TestModel is already an instance of model (hence it should be named testModel to follow JavaScript naming convention):
var testModel = new Backbone.Model({ title: "test title" })