JSFiddle - React, Tailwind, and code Playground
JavaScript
var a = [
[1, 2],
[3, [5]]
],
b = a.slice(),
c = cloneArray(a);
a[1][1][0] = 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][0], b[1][1][0], c[1][1][0]);