Hello everyone,
I am to trying to troubleshoot the problem for why this code is not working, I feel it will be something simple but i am struggling to work out why it will not pass the final condition.
Thank you,
Your code so far
function uniteUnique(arr) {
let newArray =[];
for (let i =1; i<arguments.length; i++) {
for (let j = 0; j < arguments[i].length; j++) {
if (arr.indexOf(arguments[i][j]) == -1) {
newArray.push(arguments[i][j])
}
}
return arr.concat(newArray)
}
}
console.log(uniteUnique([1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8]));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36
.
Challenge: Sorted Union
Link to the challenge: