Variables

1. Primitives and Objects thru

  1. Primitive assignment actually creates disconnected copies.

Shallow copy

Only first level variables are disconnected.

Deeper variables are still connected.

This is because the first level variables are ‘primitives’.

Deep copy

All variables are disconnected.

Obtainable by parsing and reverse parsing the object through traversing.

var <new> = {...<old>}

https://www.javascripttutorial.net/object/3-ways-to-copy-objects-in-javascript

Updated: 2026 Aug 19