The grow()
prototype method of the WebAssembly.Table
object increases the size of the Table instance by a specified number of elements.
Syntax
table.grow(number);
Parameters
- number
- The number of elements you want to grow the table by.
Return value
The previous length of the table.
Exceptions
If the grow()
operation fails for whatever reason, a RangeError
is thrown.
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 'grow()' in that specification. |
Draft | Initial draft definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
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).