I found the following code:
this.element.click((function() {
// some logic
}).bind(this));
And here is another example:
render: function () {
this.getAsyncData(function () {
this.specialFunction();
this.anotherSpecialFunction();
}.bind(this));
}
As I understand it is function chaining, is it? Here is example from which, as I understand in order to use chains we neet the previous function to return something. I mean
var gmap = function() {
this.add = function() {
alert('add');
return this; //HERE WE RETURN
}
this.del = function() {
alert('delete');
return this; //HERE WE RETURN
}
}
var test = new gmap();
test.add().del();
Could you explain how bind works without return in previous function?