| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/JavaScript_interface/Table/grow | [Back] [Original] |
Get to know MDN better
This feature is well established and works across many devices and browser versions. Its been available across browsers since October 2017.
The grow() prototype method of the WebAssembly.Table object increases the size of the Table instance by a specified number of elements, filled with the provided value.
grow(delta)
grow(delta, value)
deltaThe number of elements you want to grow the table by.
value OptionalThe element to fill the newly-allocated space with.
The previous length of the table.
RangeErrorThrown in one of the following cases:
delta exceeds the Table instance's maximum size capacity.TypeErrorThrown if value is not a value of the element type of the table.
The following example creates a new WebAssembly Table instance with an initial size of 2 and a maximum size of 10:
const table = new WebAssembly.Table({
element: "anyfunc",
initial: 2,
maximum: 10,
});
Grow the table by 1 element using Table.grow():
console.log(table.length); // 2
table.grow(1);
console.log(table.length); // 3
The following example creates a new WebAssembly Table instance with an initial size of
0 and a maximum size of 4, filling it with an object:
const myObject = { hello: "world" };
const table = new WebAssembly.Table({
element: "externref",
initial: 0,
maximum: 4,
});
Grow the table by 4 units and fill it with a value using WebAssembly.grow():
table.grow(4, myObject);
console.log(myObject === table.get(2)); // true
| Specification |
|---|
| WebAssembly JavaScript Interface # dom-table-grow |
This page was last modified on Apr 22, 2025 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |