
[JavaScript] 프로토타입과 객체 생성의 관계
·
📚STUDY/JavaScript
리터럴 표기법에 의해 생성된 객체의 생성자 함수와 프로토타입생성자 함수에 의해 생성된 인스턴스는 프로토타입의 constructor 프로퍼티에 의해 생성자 함수와 연결된다. constructor 프로퍼티가 가리키는 생성자 함수는 인스턴스를 생성한 생성자 함수다.const obj = new Object();console.log(obj.constructor === Object); // trueconst add = new Function('a', 'b', 'return a + b');console.log(add.constructor === Function); // trueconst Person(name) { this.name = name;}const me = new Person("Jung");console.l..