I’ve no idea on how to do it or correct those mistakes you mentioned here I try this based on your advice but I think not this way, here my new solution!?
function filteredArray(arr, elem) {
let newArr = [];
for(let i = 0; i < arr.length; i++){
for(let j = 0; j < arr[i].length; j++){
if(arr[i][j] != elem){
newArr.push(arr[i])
}
}
}
// change code above this line
return newArr;
}
console.log(filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3));
You need to fully check the inner array before you can make the decision to push it or not. One simple way might be to keep a count and test against it before pushing.
Or look into some array methods, see if you can find one that might be useful (one of them has a name that might be a giveaway)