Backbone.js model.defaults()

The Backbone.js defaults model is used to set a default value to a model. It ensures that if a user doesn't specify any data, the model would not fall with empty property.

Syntax:

Let's take an example.

See this example:

Test it Now

Output:

Save the above code in default.html file and open this file in a new browser.

BackboneJS Default Model