【Javascript 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.
A bound function may also be constructed using the new
operator. The provided this
value is ignored, while prepended arguments are provided to the emulated function.
示例
Simple implemention.
参考:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind