js deep clone array of objects code example
Example 1: deep clone array in javascript
const numbers = [1, [2], [3, [4]], 5];
// Using JavaScript
JSON.parse(JSON.stringify(numbers));
// Using Lodash
_.cloneDeep(numbers);
Example 2: how to make a deep copy in javascript
JSON.parse(JSON.stringify(o))