aboutsummaryrefslogtreecommitdiff
path: root/files/de/web/javascript/reference/global_objects/array/@@species/index.html
blob: c4de8a797864e03e1d5f1d943ae8919ede68c3d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
title: 'get Array[@@species]'
slug: Web/JavaScript/Reference/Global_Objects/Array/@@species
tags:
  - Array
  - JavaScript
  - Method
  - Prototype
translation_of: Web/JavaScript/Reference/Global_Objects/Array/@@species
---
<div>{{JSRef}}</div>

<p>Die <code><strong>Array[@@species]</strong></code> Zugriffseigenschaft gibt den Array Konstruktor zurück.</p>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">Array[Symbol.species]
</pre>

<h3 id="Rückgabewert">Rückgabewert</h3>

<p>Der {{jsxref("Array")}} Konstruktor.</p>

<h2 id="Beschreibung">Beschreibung</h2>

<p>Die <code>species</code> Zugriffseigenschaft gibt den Standard-Konstruktor des <code>Array</code> Objekts zurück. Unterklassen können die Zuweisung Überschreiben, um die Konstruktorzuweisung ändern.</p>

<h2 id="Beispiele">Beispiele</h2>

<p>Die <code>species</code> Eigenschaft gibt die Standard-Konstruktor-Funktion, welches der <code>Array</code> Konstruktor für <code>Array</code> Objekte ist.</p>

<pre class="brush: js">Array[Symbol.species]; // function Array()</pre>

<p>In einem abgeleiteten Collection Objekt (z. B. ein benutzerdefiniertes Array <code>MyArray</code>), ist der <code>MyArray</code> der species des <code>MyArray</code> Konstruktors. Manchmal möchte man in abgeleiteten Klassenden Oberklassenkonstruktor zurückgeben. Dieses kann mit Überschreiben erreicht werden:</p>

<pre class="brush: js">class MyArray extends Array {
  // Overwrite MyArray species to the parent Array constructor
  static get [Symbol.species]() { return Array; }
}</pre>

<h2 id="Spezifikationen">Spezifikationen</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Spezifikation</th>
   <th scope="col">Status</th>
   <th scope="col">Kommentar</th>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-get-array-@@species', 'get Array [ @@species ]')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td>Initial Definition.</td>
  </tr>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-get-array-@@species', 'get Array [ @@species ]')}}</td>
   <td>{{Spec2('ESDraft')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="Browserkompatibilität">Browserkompatibilität</h2>

<div>


<p>{{Compat("javascript.builtins.Array.@@species")}}</p>
</div>

<h2 id="Siehe_auch">Siehe auch</h2>

<ul>
 <li>{{jsxref("Array")}}</li>
 <li>{{jsxref("Symbol.species")}}</li>
</ul>