Hi there
in this article
i found typo
function alert() {
console.log( this.name + 'is calling');
}
var name = "Kingsley";
alert(); // Kingsley
alert must be “Kingsleyis calling”
wrong object defining
var myObj {
age: 22,
alert: alert
}
next code produces error because there is no myobj definition
function alert() {
console.log( this.age );
}
var obj = {
age: 22
};
var bar = function() {
alert.call( myobj );
};
bar(); // 2
setTimeout( bar, 100 ); // 22
// a hard-bound `bar` can no longer have its `this` context overridden
bar.call( window ); // still 22