WebAssembly.Table.prototype.length

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2017.

Die schreibgeschützte length Prototypeigenschaft des WebAssembly.Table-Objekts gibt die Länge der Tabelle zurück, d.h. die Anzahl der Elemente in der Tabelle.

Beispiele

Verwendung von length

Das folgende Beispiel erstellt eine neue WebAssembly-Tabelle mit einer anfänglichen Größe von 2 und einer maximalen Größe von 10:

js
const table = new WebAssembly.Table({
  element: "anyfunc",
  initial: 2,
  maximum: 10,
});

Erweitern Sie die Tabelle um 1 mit WebAssembly.grow():

js
console.log(table.length); // 2
table.grow(1);
console.log(table.length); // 3

Spezifikationen

Specification
WebAssembly JavaScript Interface
# dom-table-length

Browser-Kompatibilität

BCD tables only load in the browser

Siehe auch