[JS] Update "Explain Function.prototype.bind" part (#166)

Denoted "this" as code by using double tick mark
This commit is contained in:
Chuck C. Chao 2019-02-19 10:12:45 -06:00 committed by Yangshun Tay
parent 8663f44b33
commit b9c84126e9
1 changed files with 1 additions and 1 deletions

View File

@ -347,7 +347,7 @@ console.log(add.apply(null, [1, 2])); // 3
Taken word-for-word from [MDN](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind):
> The `bind()` method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
> The `bind()` method creates a new function that, when called, has its `this` keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
In my experience, it is most useful for binding the value of `this` in methods of classes that you want to pass into other functions. This is frequently done in React components.