오늘 한 일
prototype, constructor 는 함수만 가지고 있다.
_proto_
는 생성한 생성자의 prototype을 바라본다. class를 쓰면 너무 편하게 prototype chaning 할 수 있다.
ProtoType
- 생성자만 가질 수 있고 생성될 객체를 사용할 때 사용할 메소드들의 집합
function Human (name) {
this.name = name;
}
Human.prototype.sleep = function() { console.log('sleep')};
Constructor
- 어떤 Instance를 만들어낸 생성자를 바라본다.
const steve = new Human('steve');
steve.prototype.construct === Human // true;
proto
- 날 만든 생성자의 prototype을 바라본다.
const steve = new Human('steve');
steve.prototype.construct === Human // true;
steve._proto_ = Human.prototype // true;
coment
크하하핫 … 사실 몇 일동안 머리속 정리가 너무 힘들어서.. 새로운 마음으로 .. 하 열심히 해야지 ㅠㅠ
동기들과 코드리뷰도 진행하고 내가 알고있는 개념을 설명하면서 좀더 명확하게 다가오고 있는거 같다.