Concepts

Structured clone of shared memory

Try the free JavaScript compiler

Clones the wrapper while retaining access to shared underlying bytes; not a transfer.

Formal Syntax & Structure

javascript syntaxjavascript
structuredClone(sharedBuffer)

Parameters & Attributes

NameTypeDescription
sharedBufferSharedArrayBufferShared buffer to clone.

Return Value

SharedArrayBuffer

Clones the wrapper while retaining access to shared underlying bytes; not a transfer.

Working Example

Example Snippetjavascript
(async () => {const a=new SharedArrayBuffer(4),b=structuredClone(a);new Int32Array(b)[0]=11;console.log(a===b,new Int32Array(a)[0]);})()
JavaScript Reference