This page was translated from English by the community.Learn more and join the MDN Web Docs community.
Map[@@species]
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2016년 9월.
Map[@@species] 접근자 속성은Map 객체를 복사하는 방법을 지정하는 사용되지 않는 접근자 속성입니다.
In this article
구문
js
Map[Symbol.species]반환 값
get @@species가 호출된 생성자(this)의 값. 반환 값은 복사된Map 인스턴스를 생성하는 데 사용됩니다.
설명
@@species 접근자 속성은Map 객체에 대한 기본 생성자를 반환합니다. 하위 클래스 생성자는 생성자 할당을 변경하기 위해이를 재정의할 수 있습니다.
참고 :이 속성은 모든Map 메서드에서 현재 사용되고 있지 않습니다.
예제
>일반 객체에서의 species
@@species 속성은Map의 기본 생성자 함수인Map 을 반환합니다.
js
Map[Symbol.species]; // function Map()파생 객체에서의 species
MyMap과 같은 사용자 지정Map 하위 클래스의 인스턴스에서MyMap의 species는MyMap 생성자입니다.그러나 파생된 클래스 메서드에서 상위Map 객체를 반환하기 위해서는 이 값을 덮어쓸 수 있습니다.
js
class MyMap extends Map { // 부모 Map 생성자로 MyMap species 덮어쓰기 static get [Symbol.species]() { return Map; }}명세서
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-get-map-%symbol.species%> |