__proto__은 권장하지 않는 방식이며, 대신 Object.create( )를 사용할 수 있다.

proto

📌 Object.create( ) 1️⃣ 부모-자식객체의 생성

const superObj = {superVal : "super"};
const subObj = Obj.create(superObj);
subObj.subVal = "sub";

console.log(subObj.__proto__);//{superVal: 'super'}

📌 Object.create( ) 2️⃣ 자식객체의 속성의 수정

subObj.superVal = "sub";

console.log(subObj.superVal); // sub
console.log(subObj.__proto__);//{superVal: 'super'}
console.log(superObj.superVal); // super

💥debugger

디버거가 활성화되면 디버거 문의 위치에서 실행이 일시중지된다.

실행 상태를 sources탭에서 확인 할 수 있다.

const superObj = { superVal: "super" };
const subObj = Object.create(superObj);
subObj.subVal = "sub";

debugger;

subObj의 prototype은 super인것을 debugging을 통해 확인 할 수 있다.

subObj의 prototype은 super인것을 debugging을 통해 확인 할 수 있다.

console창에서도 확인이 가능하다.

console창에서도 확인이 가능하다.