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); // 為什么會是"hello"? alert("stu-hello");}var s = new Student();s.say();如代碼中注釋,superSay.call(this)為什么會是People.prototype.say函數被調用?this指向誰?
關于JS的this和構造函數問題
12345678_0001
2018-11-13 17:17:20
