前言
前段时间面试遇见一题,题目内容大概是
function Parent() {
this.prop = 'parent';
}
Parent.prototype.get = function() {
alert(this.prop);
};
Parent.prototype.show = function() {
setTimeout(this.get, 100);
};
var child = new Parent();
child.show(); // ÿ