I have an array (generated dynamically) which contains objects. Those objects contains arrays which sometimes are duplicated.
I wonder how could I make a function to check the arrays contained in the objects to see if they're duplicated.
In javascript.
Tried using the following function, but it will only check the objects in the first sub-array. Won't work on other sub-arrays.
var check = function (a){
var retval = [];
for (var j = 0, u = a.length; j < u; j++) {
if (a[j].items && a[j].items.length > 1){
check(a[j].items);
}
for (var k = j + 1, v = a.length; k < v; k++) {
if (a[j] && a[k]){
if (a[j]._id == a[k]._id) {
}
else{
retval.push(a[j]);
}
}
}
}
return retval;
};