en.javascript.info/1-js/06-advanced-functions/09-bind/2-write-to-object-after-bind/solution.md
Ilya Kantor ab9ab64bd5 up
2017-03-21 14:41:49 +03:00

298 B

The answer: null.

function f() {
  alert( this ); // null
}

let 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.