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
Using grow
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 |
---|
WebAssembly JavaScript Interface The definition of 'grow()' in that specification. |
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.
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
grow | Chrome Full support 57 | Edge Full support 16 | Firefox
Full support
52
| IE No support No | Opera Full support 44 | Safari Full support 11 | WebView Android Full support 57 | Chrome Android Full support 57 | Firefox Android
Full support
52
| Opera Android Full support 43 | Safari iOS Full support 11 | Samsung Internet Android Full support 7.0 | nodejs Full support 8.0.0 |
Legend
- Full support
- Full support
- No support
- No support
- See implementation notes.
- See implementation notes.