The Backbone.JS Router Extend() method extends the backbone’s router class. It also creates a new constructor and defines some triggered actions.
Syntax:
Backbone.Router.extend (properties, classProperties)
Parameters:
properties: This parameter is used to specify the properties for instance for the router class.
classProperties: This parameter is used to specify the class properties for the constructor function of the router.
Example:
Example
Output:
● Route 1 ● Route 2 ● Route 3 ● Route 4 ● Route 5
Explanation:
In the above example the Extend() method is used to extend the backbone’s router class.