[JS] Update "Explain Function.prototype.bind" part (#166)
Denoted "this" as code by using double tick mark
This commit is contained in:
parent
8663f44b33
commit
b9c84126e9
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue