When I tried with a single class and property it works fine. But if I'm using it with multiple class properties, it throws an error, such that mixchi is not a function.
var sinchan = Backbone.Model.extend({}, {
himavari: function() {
return "sinchan nuhara";
}
}, {
mixchi: function() {
return "10";
}
});
console.log(sinchan.himavari());//output sinchan nuhara
console.log(sinchan.mixchi());// output TypeError: sinchan.mixchi is not a function
I don't know where you took that, but Backbone's
extendfunction doesn't work like that.How to use
extendYour first example works because you're defining
himavariin theclassPropertiesobject (second param ofextend) which is the equivalent of a static function.