[Solved] What is `this` inside a Backbone model?

[ad_1]

this inside initialize is the instance of the model.

.bind is an alias for .on method inside backbone.Events module which allows you to bind event handlers on an object

change:name is just the event name, it allows you to track changes of a model’s attribute named 'name'.

initialize is a constructor method which will be called initially when you instantiate the model.

defaults is an object (or it can be a function) that sets default model attributes.

So initialize and defaults are indeed methods inside an object (except that defaults can be also a property), but they have special meaning for backbone. And that object is extended with all other methods and properties of Backbone.Model which makes it a functional model.

read more in backbone docs

[ad_2]

solved What is `this` inside a Backbone model?