var obj = { a : 13, b: 42, total: function() { return this.a + this.b } }
obj.total()
55
obj.total.apply({ a: 1, b: 2 })
3
var total = obj.total;
total()
NaN
var boundMethod = obj.total.bind(obj);
boundMethod()
55
boundMethod.apply({ something: 'else' })
55
obj.toString = () => this.a + ", " + this.b;
obj.toString()
"undefined, undefined"
The console allows you to interact with the course material and examples. Use the following keys:
A special logging function is also available: