diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:41:15 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:41:15 -0500 |
commit | 4b1a9203c547c019fc5398082ae19a3f3d4c3efe (patch) | |
tree | d4a40e13ceeb9f85479605110a76e7a4d5f3b56b /files/de/web/javascript/reference/global_objects/object/values | |
parent | 33058f2b292b3a581333bdfb21b8f671898c5060 (diff) | |
download | translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.gz translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.bz2 translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.zip |
initial commit
Diffstat (limited to 'files/de/web/javascript/reference/global_objects/object/values')
-rw-r--r-- | files/de/web/javascript/reference/global_objects/object/values/index.html | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/files/de/web/javascript/reference/global_objects/object/values/index.html b/files/de/web/javascript/reference/global_objects/object/values/index.html new file mode 100644 index 0000000000..f3a66e5714 --- /dev/null +++ b/files/de/web/javascript/reference/global_objects/object/values/index.html @@ -0,0 +1,148 @@ +--- +title: Object.values() +slug: Web/JavaScript/Reference/Global_Objects/Object/values +translation_of: Web/JavaScript/Reference/Global_Objects/Object/values +--- +<div>{{JSRef}}</div> + +<p style="margin-bottom: 0cm; line-height: 100%;">Die Methode <code><strong>Object.values()</strong></code> gibt ein Array mit den Eigenschaftswerten eines gegebenen Objekts in der selben Reihenfolge wie eine {{jsxref("Statements/for...in", "for...in")}}-Schleife sie geben würde zurück (Der Unterschied ist dabei, dass eine for-in Schleife zusätzlich die Eigenschaften der Protoype-Kette aufzählt).</p> + +<p style="margin-bottom: 0cm; line-height: 100%;"> </p> + +<div>{{EmbedInteractiveExample("pages/js/object-values.html")}}</div> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox">Object.values(<var>obj</var>)</pre> + +<h3 id="Parameter">Parameter</h3> + +<dl> + <dt><code>obj</code></dt> + <dd>Ein Objekt, dessen Eigenschaftswerte zurück gegeben werden sollen.</dd> +</dl> + +<h3 id="Rückgabewert">Rückgabewert</h3> + +<p>Ein Array, welches die Eigenschaftswerte eines gegebenen Objekts enthält.</p> + +<h2 id="Beschreibung">Beschreibung</h2> + +<p><code>Object.values()</code> gibt ein Array zurück, dessen Elemente mit den Werten der Eigenschaften eines gegebenen Objekts übereinstimmen. Die Reihenfolge der Eigenschaften ist die selbe, wie sie sich bei einem manuellen Durchlauf über die Eigenschaften ergeben würde.</p> + +<h2 id="Beispiele">Beispiele</h2> + +<pre class="brush: js">var obj = { foo: 'bar', baz: 42 }; +console.log(Object.values(obj)); // ['bar', 42] + +// Array-ähnliches Objekt +var obj = { 0: 'a', 1: 'b', 2: 'c' }; +console.log(Object.values(obj)); // ['a', 'b', 'c'] + +// Array-ähnliches Objekt mit zufälliger Sortierung der Eigenschaften +var an_obj = { 100: 'a', 2: 'b', 7: 'c' }; +console.log(Object.values(an_obj)); // ['b', 'c', 'a'] + +// getFoo ist eine nicht aufzählbare Eigenschaft +var my_obj = Object.create({}, { getFoo: { value: function() { return this.foo; } } }); +my_obj.foo = 'bar'; +console.log(Object.values(my_obj)); // ['bar'] + +// non-object argument will be coerced to an object +console.log(Object.values('foo')); // ['f', 'o', 'o'] +</pre> + +<h2 id="Polyfill">Polyfill</h2> + +<p>Um <code>Object.values</code> auch in älteren Umgebungen zu nutzen, die diese Methode nicht nativ unterstützen, können Sie ein Polyfill im <a href="https://github.com/tc39/proposal-object-values-entries">tc39/proposal-object-values-entries</a> oder im <a href="https://github.com/es-shims/Object.values">es-shims/Object.values</a> Repository finden.</p> + +<h2 id="Spezifikationen">Spezifikationen</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specifikation</th> + <th scope="col">Status</th> + <th scope="col">Kommentar</th> + </tr> + <tr> + <td>{{SpecName('ESDraft', '#sec-object.values', 'Object.values')}}</td> + <td>{{Spec2('ESDraft')}}</td> + <td>Erste Definition.</td> + </tr> + <tr> + <td>{{SpecName('ES8', '#sec-object.values', 'Object.values')}}</td> + <td>{{Spec2('ES8')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_Kompatibilität">Browser Kompatibilität</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatChrome(54)}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop(47)}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatSafari(10.1)}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android Webview</th> + <th>Chrome for Android</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatChrome(54)}}</td> + <td>{{CompatChrome(54)}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile(47)}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatSafari(10.3)}}</td> + </tr> + </tbody> +</table> +</div> + +<p> </p> + +<p>Siehe auch</p> + +<ul> + <li><a href="/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties">Enumerability and ownership of properties</a></li> + <li>{{jsxref("Object.keys()")}}</li> + <li>{{jsxref("Object.entries()")}} {{experimental_inline}}</li> + <li>{{jsxref("Object.prototype.propertyIsEnumerable()")}}</li> + <li>{{jsxref("Object.create()")}}</li> + <li>{{jsxref("Object.getOwnPropertyNames()")}}</li> +</ul> |