A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/of below:

TypedArray.of() - JavaScript | MDN

TypedArray.of()

Baseline Widely available

Die statische Methode TypedArray.of() erstellt ein neues typisiertes Array aus einer variablen Anzahl von Argumenten. Diese Methode ist fast identisch mit Array.of().

Probieren Sie es aus
const int16array = Int16Array.of("10", "20", "30", "40", "50");

console.log(int16array);
// Expected output: Int16Array [10, 20, 30, 40, 50]
Syntax
TypedArray.of()
TypedArray.of(element1)
TypedArray.of(element1, element2)
TypedArray.of(element1, element2, /* …, */ elementN)

Wobei TypedArray eine der folgenden ist:

Parameter
element1, …, elementN

Elemente, die zur Erstellung des typisierten Arrays verwendet werden.

Rückgabewert

Eine neue Instanz von TypedArray.

Beschreibung

Siehe Array.of() für weitere Details. Es gibt einige subtile Unterschiede zwischen Array.of() und TypedArray.of():

Beispiele Verwendung von of()
Uint8Array.of(1); // Uint8Array [ 1 ]
Int8Array.of("1", "2", "3"); // Int8Array [ 1, 2, 3 ]
Float32Array.of(1, 2, 3); // Float32Array [ 1, 2, 3 ]
Int16Array.of(undefined); // Int16Array [ 0 ]
Spezifikationen Browser-Kompatibilität Siehe auch

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4