//Cloning arrays:
function deepCopyArray(arr) {
if (Array.isArray(arr)) {
var copy = [];
for (let z = 0; z < arr.length; z++) {
copy[z] = deepCopyArray(arr[z])
}
return copy;
} else if (typeof arr === 'object' && arr !== null) {
var copy = {};
for (var key in arr) {
if (arr.hasOwnProperty(key)) {
copy[key] = deepCopyArray(arr[key]);
}
}
return copy;
} else {
return arr;
}
}
if (editedInsList.length == 0) {
editedInsList = deepCopyArray(defaultInsList);
editedInsList2 = deepCopyArray(defaultInsList);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |