0

How do you clone an Array of Objects in Javascript?

JavaScript
const myArray = [{'1': '1'}, {'2':'2'}, {'3':'3'}, {'4':'4'}];

const clonedArray = myArray.map(a => Object.assign({}, a));

console.log(myArray === clonedArray); // false

console.log(myArray.lenght === clonedArray.lenght); // true
RUN
add comment
Suggest a different solution or add another example