en.javascript.info/1-js/8-more-functions/7-bind/2-write-to-object-after-bind/solution.md
Ilya Kantor d4c714cbe1 work
2016-08-05 16:53:08 +03:00

18 lines
298 B
Markdown

The answer: `null`.
```js run
function f() {
alert( this ); // null
}
var user = {
g: f.bind(null)
};
user.g();
```
The context of a bound function is hard-fixed. There's just no way to further change it.
So even while we run `user.g()`, the original function is called with `this=null`.