为什么这句superSay.call(this);就可以让浏览器先提示"Hello",然后再"stu-Hello"呢
function People(){
}
People.prototype.say = function(){
alert("Hello");
}
function Student(){
}
Student.prototype = new People();
var superSay = Student.prototype.say;
Student.prototype.say = function (){
superSay.call(this);
alert("stu-Hello");
}
var s = new Student();
s.say();
相关分类