Hello, I believe I have written some code that while not elegant does pass all of the test cases for Sorted Union. However, when I submit the code I do not see that any of the test cases have registered as a pass. Could someone explain to me a) why this is the case or b) why my code is defective? Please see below and thank you in advance!
function uniteUnique(arr) {
var arr = [];
var unique = [];
for (var i = 0; i < arguments.length; i++){
arr.push(arguments[i]);
}
for (var i = 0; i < arr.length; i++){
for (var j = 0; j < arr[i].length; j++){
if (unique.indexOf(arr[i][j]) === -1){
unique.push(arr[i][j]);
}
}
}
return unique;
}
uniteUnique([1,2,3], [5,2,1,4], [2,1], [6,7,8]);