Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2016년 9월.
Reflect.construct() 정적 메서드는 new 연산자처럼 동작하는 함수입니다. new target(...args)를 호출하는 것과 같습니다. 추가 기능으로 다른 프로토타입을 지정할 수도 있습니다.
호출할 대상 함수.
argumentsListtarget의 매개변수로 전달할 배열형 객체.
newTarget Optional프로토타입으로 사용할 생성자. new.target 연산자도 확인하세요. newTarget이 주어지지 않았을 땐 target을 사용합니다.
target을 생성자로 하고 주어진 매개변수를 전달해 생성한 target(또는, 지정했다면 newTarget)의 새로운 인스턴스.
target 또는 newTarget이 생성자가 아니면 TypeError.
Reflect.construct()는 생성자를 가변 길이의 매개변수로 호출할 수 있습니다. (new 연산자와 전개 구문을 사용해도 가능합니다)
Reflect의 도입 이전에는 임의의 생성자와 프로토타입에 Object.create()를 사용해 객체를 생성할 수 있었습니다.
그러나, 결과는 동일하더라도 과정에는 중요한 차이가 하나 존재합니다. Object.create()와 Function.prototype.apply()를 사용할 땐, 객체 생성에 new 키워드가 관여하지 않으므로 new.target 연산자가 undefined를 가리킵니다.
반면 Reflect.construct()를 호출하면, newTarget이 존재하면 new.target 연산자가 newTarget을, 아니면 target을 가리킵니다.
| ECMAScript® 2027 Language Specification # sec-reflect.construct |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025년 2월 11일 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.