W3cubDocs

/JavaScript

WebAssembly.table.length

The length prototype property of the WebAssembly.Table object returns the length of the table, i.e. the number of elements in the table.

Syntax

table.length;

Examples

The following example creates a new WebAssembly Table instance with an initial size of 2 and a maximum size of 10.

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

You can then grow the table by 1 with the following:

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

Specifications

Specification Status Comment
WebAssembly JavaScript API
The definition of 'length' in that specification.
Draft Initial draft definition.

Browser compatibility

Feature Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 57 16 522 No 44 11
Feature Android webview Chrome for Android Edge mobile Firefox for Android IE mobile Opera Android iOS Safari
Basic support 57 57 Yes1 522 No ? 11

1. This feature is behind the Experimental JavaScript Features preference.

2. Disabled in the Firefox 52 Extended Support Release (ESR).

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table/length