나는 기본적인 자바 스크립트 질문을 가지고있어서 대답하기에 적절한 구글 쿼리를 만들지도 못한다. 예를 들면 :프로토 타입의 부모를 어떻게 참조 할 수 있습니까?
function Parent(name){
this.name = name;
}
Parent.prototype.Child() = function(){
if(this.name == 'Sam'){ // This is the comparison that obviously doesn't work
/* Do something */
} else {
/* Do something else */
}
}
var Parent1 = new Parent('Sam');
var Child1 = new Parent1.Child();
비교를 위해 부모 대신 "name"속성에 액세스 할 수있는 키워드가 있습니까?
건배!
'Parent.prototype.Child() = function() {'은 (는)'Parent.prototype.Child = function() {'이어야합니다. – Musa