var p = function() {
this.show = function() {
alert('hello world!!!');
}
}
p.prototype.show = function() {
alert('haha');
}
var o = new p();
o.show();
경고가 "hello world!!!"
인 이유는 무엇입니까?프로토 타입에 선언 된 함수가 호출되지 않는 이유는 무엇입니까?
프로토 타입 방법을 수정할 수 있습니까?
매우 철저한 설명 : http://stackoverflow.com/questions/310870/use-of-prototype-vs-this-in-javascript –
FYI : 다음과 같은 경우 프로토 타입 방법을 호출 할 수 있습니다.'p. prototype.show.call (o)' – Prinzhorn