function parent(){
이것 .x= 10;
}
function child(){
var parentObj=new parent()
for(var p in parentObj)
}
var childObj=new child();
alert(childObj.x)
function parent(){
this.x=10;
}
function child(){
this.parent= parent;
this.parent();
delete this.parent;
}
var childObj=new child()
alert(childObj.x);
함수 부모( ){
this.x= 10;
}
function child(){
parent.call(this)
}
var childObj=new child(); >alert(childObj.x);
프로토타입 전사
function parent(){
}
parent.prototype.x=1
function child(){
}
for(var p in parent.prototype[p];
child.prototype.y=2;
var childObj=new child(); 🎜>alert(childObj.x);
function parent(string){
var child=new Function("this.x=10;" string)
return child;
}
var child=new parent ("this.y=20;");
var childObj=new child();
alert(childObj.y)
코드 복사
function child(){
}
child.prototype =new parent();
var childObj=new child()
alert(childObj.x); >
코드 복사
코드는 다음과 같습니다.
return
}
var childObj=new child();
alert(childObj.x)