상속
function person(name) {
this.name = name;
this.introduce = function() {
return 'My name is '+this.name;
}
}
var p1 = new person('egoing');//객체를 생성하는 생성자.
document.write(p1.introduce()+"<br />");function person(name) {
this.name = name;
}
person.prototype.name = null;
person.prototype.introduce = function() {
return 'My name is '+this.name;
}
var p1 = new person('egoing');//introduce 메소드가 실행된다.
document.write(p1.introduce()+"<br />");Last updated