Language concepts

Structural sharing

Try the free JavaScript compiler

Reuses unchanged branches between state versions. Avoid mutating shared branches; this is a design convention, not a deep-freeze guarantee.

Formal Syntax & Structure

javascript syntaxjavascript
next.unchanged === previous.unchanged

Working Example

Example Snippetjavascript
const a={x:1,meta:{id:3}};const b={...a,x:2};console.log(a.meta===b.meta);
JavaScript Reference