aboutsummaryrefslogtreecommitdiff
path: root/files/de/orphaned/web/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'files/de/orphaned/web/javascript')
-rw-r--r--files/de/orphaned/web/javascript/reference/errors/typed_array_invalid_arguments/index.html78
1 files changed, 78 insertions, 0 deletions
diff --git a/files/de/orphaned/web/javascript/reference/errors/typed_array_invalid_arguments/index.html b/files/de/orphaned/web/javascript/reference/errors/typed_array_invalid_arguments/index.html
new file mode 100644
index 0000000000..7d379b7a5b
--- /dev/null
+++ b/files/de/orphaned/web/javascript/reference/errors/typed_array_invalid_arguments/index.html
@@ -0,0 +1,78 @@
+---
+title: 'TypeError: invalid arguments'
+slug: orphaned/Web/JavaScript/Reference/Errors/Typed_array_invalid_arguments
+tags:
+ - Error
+ - Errors
+ - JavaScript
+ - TypeError
+translation_of: Web/JavaScript/Reference/Errors/Typed_array_invalid_arguments
+original_slug: Web/JavaScript/Reference/Errors/Typed_array_invalid_arguments
+---
+<div>{{jsSidebar("Errors")}}</div>
+
+<h2 id="Fehlermeldung">Fehlermeldung</h2>
+
+<pre class="syntaxbox">TypeError: invalid arguments (Firefox)</pre>
+
+<h2 id="Fehlertyp">Fehlertyp</h2>
+
+<p>{{jsxref("TypeError")}}</p>
+
+<h2 id="Was_ist_falsch_gelaufen">Was ist falsch gelaufen?</h2>
+
+<p>Der <a href="/de/docs/Web/JavaScript/Typed_arrays">Typed Array</a> Konstruktor erwartet entweder</p>
+
+<ul>
+ <li>eine Länge,</li>
+ <li>ein anderes Typed Array,</li>
+ <li>Array ähnliche Objete,</li>
+ <li>iterierbare Objekte oder</li>
+ <li>ein {{jsxref("ArrayBuffer")}} Objekt,</li>
+</ul>
+
+<p>um ein neues Typed Array zu erstelltn. Andere Argumente im Konstruktor erstellen kein valides Typed Array.</p>
+
+<h2 id="Beispiele">Beispiele</h2>
+
+<p>Typed Arrays, zum Beispiel ein {{jsxref("Uint8Array")}}, können nicht von einem String erstellt werden. <span class="short_text" id="result_box" lang="de"><span>Tatsächlich können String nicht in typisierten Arrays enthalten sein.</span></span></p>
+
+<pre class="brush: js example-bad">var ta = new Uint8Array("nope");
+// TypeError: invalid arguments
+</pre>
+
+<p>Verschiedene Wege um ein valides {{jsxref("Uint8Array")}} Objekt zu erstellen:</p>
+
+<pre class="brush: js example-good">// From a length
+var uint8 = new Uint8Array(2);
+uint8[0] = 42;
+console.log(uint8[0]); // 42
+console.log(uint8.length); // 2
+console.log(uint8.BYTES_PER_ELEMENT); // 1
+
+// From an array
+var arr = new Uint8Array([21,31]);
+console.log(arr[1]); // 31
+
+// From another TypedArray
+var x = new Uint8Array([21, 31]);
+var y = new Uint8Array(x);
+console.log(y[0]); // 21
+
+// From an ArrayBuffer
+var buffer = new ArrayBuffer(8);
+var z = new Uint8Array(buffer, 1, 4);
+
+// From an iterable
+var iterable = function*(){ yield* [1,2,3]; }();
+var uint8 = new Uint8Array(iterable);
+// Uint8Array[1, 2, 3]
+</pre>
+
+<h2 id="Siehe_auch">Siehe auch</h2>
+
+<ul>
+ <li><a href="/de/docs/Web/JavaScript/Typed_arrays">Typed arrays</a></li>
+ <li>{{jsxref("ArrayBuffer")}}</li>
+ <li>{{jsxref("Uint8Array")}}</li>
+</ul>