
프로토타입의 definition부터 살표보면 "preliminary model of something" 무언가의 첫번째 예비 모델. 그리고 모델을 사용해 새로운 형태가 개발되는 것이다. 그래서 프로토타입은 완성된 형태를 의미하는게 아니라, 실제의 제품을 만들기전에 대략적인 형태만 나태내는 것이다.
Prototype은 ES5에서 소개된 생성자 함수이다. 지금은 ES6에서 출시된 Class를 사용하지만, 이전에는 Protype을 사용했었다. 포멧은 Class와 유사하지만, constructor()를 사용하지 않는다. 대신 function(매개변수가 property)를 사용한다.
const Person = function(firstName, birthYear){
this.firstName = firstName;
this.birthYear = birthYear
}
let james = new Person('James', 1991)
let sarah = new Person('Sarah', 1990)
Class.prototype.key = value (ES6) 에서 property를 사용하는 것처럼,
Prototype.prototype.key = value (ES5) 사용이 가능하다.