JSFiddle - React, Tailwind, and code Playground
JavaScript
var a = [
[1, 2],
[3, {x: 5}]
],
b = a.slice(),
c = cloneArray(a);
a[1][1].x = 9;
function cloneArray(mas) {
var masClone = new Array(mas.length);
mas.forEach(function (item, key) {
if (Array.isArray(item)) {
masClone[key] = cloneArray(item);
} else {
masClone[key] = item;
}
});
return masClone;
}
console.log(a[1][1].x, b[1][1].x, c[1][1].x);