Ember.js this.super() what is the purpose
ember.js
Solution
Calling `this._super()` in the `init` calls the `init` function of the superclass.
The documentation gives this example:
App.Person = Ember.Object.extend({
say: function(thing) {
var name = this.get('name');
alert(name + " says: " + thing);
}
});
App.Soldier = App.Person.extend({
say: function(thing) {
this._super(thing + ", sir!");
}
});
var yehuda = App.Soldier.create({
name: "Yehuda Katz"
});
yehuda.say("Yes"); // alerts "Yehuda Katz says: Yes, sir!"
Problem
Lot of times i see the function ``` init: function() { return this._super(); }, ``` What is the purpose of this function and when to use them? Can someone explain to me practically use?