CodesJava

Easy learning with example program codes

Backbone.JS Extend()

The Backbone.JS Extend() model extends the Backbone.model class while creating a backbone model.

Syntax:

Backbone.Model.Extend( properties, classProperties )    

Parameters:
properties: This parameter is used to specify the instance properties for the Model class.
classProperties: This parameter is attached to the constructor function.

Example:

<!DOCTYPE html>  
<html>  
<head>  
<title>Example</title>  
<script src="https://code.jquery.com/jquery-2.1.3.min.js" type="text/javascript"></script>  
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js" 
type="text/javascript"></script>  
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js" 
type="text/javascript"></script>  
<script type="text/javascript">  
X = Backbone.Model.extend({  
initialize: function(){  
document.write("Hello World!");  
}  
});  
var Y = new X;  
</script>  
</head>  
</html>

Output:

Hello World!

Explanation:
The Backbone.JS Extend() model will extend the Backbone.model class while creating a backbone model.

Please follow and like us:
error









Copyright © 2019 CodesJava DMCA.com Protection Status