const memory = new WebAssembly.Memory({
initial: 1,
maximum: 10,
});WebAssembly.Memory.prototype.grow() / notebook
WebAssembly.Memory.prototype.grow()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const bytesPerPage = 64 * 1024;
console.log(memory.buffer.byteLength / bytesPerPage); // "1"
console.log(memory.grow(1)); // "1"
console.log(memory.buffer.byteLength / bytesPerPage); // "2"const memory = new WebAssembly.Memory({
address: "i64",
initial: 1n,
maximum: 10n,
});
console.log(memory.grow(1n)); // 1n