[JavaScript] super
class Person {constructor(name, first, second) {this.name = name;this.first = first;this.second=second;}sum() {return this.first+this.second;}} class PersonPlus extends Person {constructor(name, first, second, third) {super(name, first, second);this.third=third;}sum() {return super.sum()+this.third;}avg() {return (this.first+this.second+this.third)/3;}} var kim = new PersonPlus('kim', 10, 20, 30..
[JavaScript] prototype
function Person(name, first, second, third) {this.name=name;this.first=first;this.second=second;this.third=third;} Person.prototype.sum = function( ) {return this.first+this.second+this.third;} var kim = new Person('kim', 10, 20, 30); kim.sum = function(){return 'this : '+(this.first+this.second+this.third);} var lee = new Person('lee', 10, 10, 10);console.log("kim.sum()", kim.sum());-> kim.sum(..