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년 3월.
extends 키워드는 클래스를 다른 클래스의 자식으로 만들기 위해 class 선언 또는 class 식에 사용됩니다.
extends 키워드는 내장 객체뿐만 아니라 사용자 정의 클래스를 하위 클래스로 만들기 위해 사용될 수 있습니다.
확장( 클래스)의 .prototype은 Object 또는 null이어야 합니다.
첫 번째 예는 Polygon 클래스로부터 Square 클래스를 만듭니다. 이 예는 live demo (source)에서 발췌했습니다.
이 예제는 내장 객체 Date를 확장합니다. 이 예제는 live demo (source)에서 발췌했습니다.
null에서 확장은 prototype 객체가 Object.prototype으로부터 상속받지 않은 것을 제외하면 보통 클래스처럼 동작합니다.
| ECMAScript® 2027 Language Specification # sec-class-definitions |
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.