# 상속

ES5

function Person(name, age) {
  this.name = name;
  this.age = age;
}
function Student(name, age, grade) {
  Person.call(this, name, age);
  this.grade = grade;
}

Student.prototype = Object.create(Person.prototype);
// Object.create() 메서드는 지정된 프로토타입 객체 및 속성(property)을 갖는 새 객체를 만듭니다.
// Object.create(proto[, propertiesObject])
Student.prototype.constructor = Student;
// 확인!
const student = new Student('boseok', 10, 'SSS');
student instanceof Student; // true
student instanceof Person; // true

ES6

// ES
class Student extends Person {
  constructor(name, age, grade) {
    super(name, age);
    this.grade = grade;
  }
}
// ES6
class Person {
  constructor(name, age) {
    this.name = name;
    this.age = age;
  }
}