강의

멘토링

커뮤니티

Inflearn Community Q&A

rhkdtjd124829's profile image
rhkdtjd124829

asked

Advanced Modern Javascript with ES6 Grammar Part 1

Internal workings of the new operator

제가 이해한게 맞을까요?

Written on

·

219

·

Edited

0

 [1]: 내부적으로는 빈 객체를 생성한 후에 --> 같은 이름의 "프로토타입 객체"를 새로운 객체의 원형(프로토타입)으로 설정.
      즉, new 연산자로 빈객체를 생성한 후에 (tiger, lion) 객체의 원형으로 Animal 프로토타입 객체를 숨은링크로 가르킨다(참조).

 Animal 함수                                                             Animal 프로토타입 객체
 + prototype --> Animal 프로토타입 객체(참조)                                + constructor --> Animal 함수(참조)
 + new를 통해서 tiger객체나 lion객체를 생성

 tiger객체
 + prototype --> 원형인 Animal프로토타입 객체를 참조

 lion객체
 + prototype --> 원형인 Animal프로토타입 객체를 참조
es6javascript

Answer

This question is waiting for answers
Be the first to answer!
rhkdtjd124829's profile image
rhkdtjd124829

asked

Ask a question