NATIVE

settings_applicationsObject

NATIVE

Editing
  • account_tree
  • bug_report

ObjectnewObjectcreate(Objectprototype, ObjectpropertiesDescriptor])

기존 객체를 프로토타입으로 사용하여 새로운 객체를 생성하여 반환한다.

구문

형식
Object.create(prototype[, propertiesDescriptor])

매개 변수

Objectprototype필수
새로운 객체를 생성시 사용할 프로토타입 객체
ObjectpropertiesDescriptor선택

프로퍼티에 대한 configurable, enumerable, value, writable, get, set 명세가 설정된 객체

반환

ObjectnewObject

새로 생성한 객체를 반환한다. 첫 번째 prototype 매개변수가 null 또는 객체가 아닌 경우 TypeError 예외가 발생(throw) 한다.

Exception

TypeError

동적 타입의 값이 흐름상 맞지 않는 자료형이라 연산을 할 수 없을 때 발생하는 오류를 다루는 객체이다.

기술 문서

Object.create() 정적 메소드를 이용한 상속의 예

버전 명세

ECMAScript 2024(15th Edition)
#sec-object.create

지원 웹브라우저