JS Built-ins
structuredClonebeginner

Deep Clone an Array

πŸ“– Usage Example
const map = new Map([['key', 'value']])
const clone = structuredClone(map)
clone.get('key')  // β†’ 'value'

structuredClone() supports Maps, Sets, Dates, and other complex types that JSON.parse/stringify cannot handle.

Use structuredClone() to create a deep copy of a nested array.

πŸ’‘ Hints (1)
  • β€’ structuredClone works with arrays and nested arrays