From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- .../global_objects/array/@@species/index.html | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 files/ko/web/javascript/reference/global_objects/array/@@species/index.html (limited to 'files/ko/web/javascript/reference/global_objects/array/@@species') diff --git a/files/ko/web/javascript/reference/global_objects/array/@@species/index.html b/files/ko/web/javascript/reference/global_objects/array/@@species/index.html new file mode 100644 index 0000000000..7b1bda0ca6 --- /dev/null +++ b/files/ko/web/javascript/reference/global_objects/array/@@species/index.html @@ -0,0 +1,75 @@ +--- +title: 'get Array[@@species]' +slug: Web/JavaScript/Reference/Global_Objects/Array/@@species +tags: + - Array + - JavaScript + - Method + - Prototype + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Array/@@species +--- +
{{JSRef}}
+ +

Array[@@species] 접근자 속성은 Array 생성자를 반환합니다.

+ +

구문

+ +
Array[Symbol.species]
+
+ +

반환 값

+ +

{{jsxref("Array")}} 생성자.

+ +

설명

+ +

species 접근자 속성은 Array 객체의 기본 생성자를 반환합니다. 서브클래스 생성자는 생성자 할당을 변경하기 위해 이 속성을 재정의할 수 있습니다.

+ +

예제

+ +

species 속성은 Array 객체의 Array 생성자를 반환합니다.

+ +
Array[Symbol.species]; // function Array()
+ +

파생 콜렉션 개체(예시: 사용자 설정 배열인 MyArray)에서, MyArrayspeciesMyArray 생성자입니다. 그러나 이 속성을 재정의하면 파생 클래스 메서드에서 상위 Array 객체를 반환할 수 있습니다.

+ +
class MyArray extends Array {
+  // MyArray species를 부모 Array 생성자로 재설정
+  static get [Symbol.species]() { return Array; }
+}
+ +

명세

+ + + + + + + + + + + + + + + + + + + +
명세상태비고
{{SpecName('ES6', '#sec-get-array-@@species', 'get Array [ @@species ]')}}{{Spec2('ES6')}}Initial definition.
{{SpecName('ESDraft', '#sec-get-array-@@species', 'get Array [ @@species ]')}}{{Spec2('ESDraft')}} 
+ +

브라우저 호환성

+ + + +

{{Compat("javascript.builtins.Array.@@species")}}

+ +

같이 보기

+ + -- cgit v1.2.3-54-g00ecf