function SuperType(name) { this.name = name; this.friends = ["kim", "lee", "park"]; } SuperType.prototype.sayName = function() { document.write(this.name + "<br>"); }; function SubType(name, age) { SuperType.call(this, name); // SuperType() 두번째 호출 this.age = age; } SubType.prototype = new SuperType() // SuperType() 첫번째 호출 SubType.prototype.constructor = SubType; SubType.prototype.sayAge = function() { document.write(this.age + "<br>"); }