Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. JavaScript
  3. JavaScript-Referenz
  4. Eingebaute Standardobjekte
  5. TypedArray
  6. entries()

Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten.Erfahre mehr über dieses Experiment.

View in EnglishAlways switch to English

TypedArray.prototype.entries()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨September 2016⁩.

Dieentries() Methode vonTypedArray Instanzen gibt ein neuesArray-Iterator Objekt zurück, das die Schlüssel/Wert-Paare für jeden Index im typisierten Array enthält. Diese Methode hat denselben Algorithmus wieArray.prototype.entries().

Probieren Sie es aus

const uint8 = new Uint8Array([10, 20, 30, 40, 50]);const eArr = uint8.entries();eArr.next();eArr.next();console.log(eArr.next().value);// Expected output: Array [2, 30]

Syntax

js
entries()

Parameter

Keine.

Rückgabewert

Ein neuesiterierbares Iterator-Objekt.

Beschreibung

SieheArray.prototype.entries() für mehr Details. Diese Methode ist nicht generisch und kann nur auf typisierten Array-Instanzen aufgerufen werden.

Beispiele

Iteration mit der for...of Schleife

js
const array = new Uint8Array([10, 20, 30, 40, 50]);const arrayEntries = arr.entries();for (const element of arrayEntries) {  console.log(element);}

Alternative Iteration

js
const array = new Uint8Array([10, 20, 30, 40, 50]);const arrayEntries = arr.entries();console.log(arrayEntries.next().value); // [0, 10]console.log(arrayEntries.next().value); // [1, 20]console.log(arrayEntries.next().value); // [2, 30]console.log(arrayEntries.next().value); // [3, 40]console.log(arrayEntries.next().value); // [4, 50]

Spezifikationen

Specification
ECMAScript® 2026 Language Specification
# sec-%typedarray%.prototype.entries

Browser-Kompatibilität

Siehe auch

Help improve MDN

Learn how to contribute Diese Seite wurde automatisch aus dem Englischen übersetzt.

[8]ページ先頭

©2009-2025 Movatter.jp