Skip to main content Accessibility Feedback

Extract & Copy Properties


The structuredClone() method accepts an array or object as an argument, and returns a deep copy or deep clone.

// A multidimensional array
let wizards = [{
	name: 'Radagast',
	color: 'brown'
}, {
	name: 'Gandalf',
	color: 'gray'

// Create a copy of the wizards array
let wizardsCopy = structuredClone(wizards);

Find this useful? You can support my work by purchasing an annual membership.