aboutsummaryrefslogtreecommitdiff
path: root/files/de/web/javascript/reference/global_objects/array/@@unscopables/index.html
blob: 2cb4b51b1136d858f3d509afe31c2f72e5e19c1b (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: 'Array.prototype[@@unscopables]'
slug: Web/JavaScript/Reference/Global_Objects/Array/@@unscopables
tags:
  - Array
  - ECMAScript 2015
  - JavaScript
  - Property
  - Prototype
translation_of: Web/JavaScript/Reference/Global_Objects/Array/@@unscopables
---
<div>{{JSRef}}</div>

<p>Die <code><strong>@@unscopable</strong></code> Symbol Eigenschaft enthält Namen von Eigenschaften, welche vor der ES2015 Version nicht im ECMAScript Standard waren. Diese Eigenschaften werden bei <code><a href="/en-US/docs/Web/JavaScript/Reference/Statements/with">with</a></code> Statement Bindungen ignoriert.</p>

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

<pre class="syntaxbox"><var>arr</var>[Symbol.unscopables]</pre>

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

<p>Der Standard Array Eigenschaften, die von den <code>with</code> Bindungen ausgenommen werden, sind: <code>copyWithin</code>, <code>entries</code>, <code>fill</code>, <code>find</code>, <code>findIndex</code>, <code>includes</code>, <code>keys</code>, und <code>values</code>.</p>

<p>Siehe {{jsxref("Symbol.unscopables")}} für das setzten von <code>unscopables</code> für eigene Objekte</p>

<p>{{js_property_attributes(0,0,1)}}</p>

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

<p>Der Folgende Quelltext funktioniert in ES5 und niedriger. Jedoch wurde in ECMAScript 2015 und Später die {{jsxref("Array.prototype.keys()")}} eingeführt. Das bedeutet, dass in <code>with</code> Umgebungen "keys" jetzt eine Methode und keine Variable ist. Hier kommt die eingebaute <code>@@unscopables</code> <code>Array.prototype[@@unscopables]</code> Symboleigenschaft ins Spiel und verhindert, dass einige der Array Methoden in einer <code>with</code> Anweisung gescoped werden.</p>

<pre class="brush: js">var keys = [];

with (Array.prototype) {
  keys.push('something');
}

Object.keys(Array.prototype[Symbol.unscopables]);
// ["copyWithin", "entries", "fill", "find", "findIndex",
//  "includes", "keys", "values"]</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">Komment</th>
  </tr>
  <tr>
   <td>{{SpecName('ES2015', '#sec-array.prototype-@@unscopables', 'Array.prototype[@@unscopables]')}}</td>
   <td>{{Spec2('ES2015')}}</td>
   <td>Initiale Definition.</td>
  </tr>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-array.prototype-@@unscopables', 'Array.prototype[@@unscopables]')}}</td>
   <td>{{Spec2('ESDraft')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

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

<div>


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

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

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