Backbone.JS Clear()

The Backbone.JS Clear() model removes all attributes, including the id attribute also.

Syntax:

Model.Clear (options)   

Parameters:
options: This parameter is used to define options like id, name, etc.

Example:

  
  
  
 Clear Example  
  
  
  
  

  

Output:

Student Name: Tom
Student id: 100

Student Name After using clear: undefined
Student id After using clear: undefined

Explanation:
After Clear all the attributes of a model are undefined.