Backbone.JS Previous()

The Backbone.JS Previous() model is used to determine the previous value of the changed attribute of a model.

Syntax:

Model.Previous (attributes)   

Parameters:
attributes: This parameter is used to specify the properties of a model.

Example:

  

  
Example  
  
  
  
  
  
  
  
   

Output:

Value of msg1 after set: {"msg1":"Hello World."}
Previous value of msg1: HELLO WORLD.

Explanation:
In the above example, the msg1 vale has changed and thus the previous value is determined along with the changed value.