자바스크립트 입문_constructor 프로퍼티
자바스크립트
2021. 5. 19. 14:00
(본 포스팅은 위키북스의 '코어자바스크립트' 책을 공부하면서 작성되었습니다_내돈내산) 생성자 함수의 프로퍼티인 prototype객체 내부에는 constructor 라는 프로퍼티가 있음.(당연히 인스턴스의 __proto__ 개체 내부에도 있음) 원래의 생성자 함수 (자기자신)을 참조함. 인스턴스로부터 그 인스턴스의 원형이 뭔지 알 수 있는 수단이 됨. var arr = [1,2]; Array.prototype.constuctor === Array// true arr.__proto__.consructor === Array// true arr.constructor === Array // true var arr2 = new arr.constructor(3, 4); console.log(arr2);// [3, 4..