Hi there.
There is something i don't understand with .bind in this trunk of code, could someone plz explain it = |
There is something i don't understand with .bind in this trunk of code, could someone plz explain it = |
Why do we put .bind here? I see no meaning of doing that in this code = |Game_Enemy.prototype.makeDropItems = function() {
if (this._treasure.checked) {
return this._treasure.item;
} else {
return this.enemy().dropItems.reduce(function(r, di) {
if (di.kind > 0 && Math.random() * di.denominator < this.dropItemRate()) {
return r.concat(this.itemObject(di.kind, di.dataId));
} else {
return r;
}
}.bind(this), []);
};
};
