Deep copy of array with nested objects

Js

by Julian Garcia Castillo

JavaScript

let array1 = [
{
name : "julian",
cars: {
	wheels :{
  	"michelin": true
  }
}
},
{
name : "maria",
cars: {
	wheels :{
  	"michelin": true
  }
}
}
]
let array2 = [];

array2 = JSON.parse(JSON.stringify(array1));

array1[0].cars.wheels.michelin = false
console.log(array1, array2)