자바스크립트의 모든 객체는 Prototype을 가짐
• [[Prototype]] 펼쳐서 살펴볼 것
• 빈 객체임에도 위의 메서드들이 사용 가능한 것은 프로토타입 때문
const obj = {};
console.log(obj);
console.log(
obj.toString()
);
console.log(
obj.valueOf()
);
Object - 모든 것의 조상
[[Prototype]]의 [[Prototype]]이 Object임 확인[[Prototype]]의 메서드들 확인console.log(
new String('')
);
console.log(
[]
);
console.log(
new Map()
);