Sorry if this has been asked but for some of the challenging questions I usually work out the code in my own editor and then paste it into FCC’s window, and sometimes vise versa when I want to play around with the code a bit. I haven’t had any problems with it yet until I came across this challenge in Basic Data Structures: Iterate Through All an Array’s Items Using For Loops
The following code passes in FCC but i get an empty array when I try running it in my own editor. Any reason why? Thanks
function filteredArray(arr, elem) {
let newArr = [];
for (let i = 0; i < arr.length; i++) {
if (arr[i].indexOf(elem) === -1) {
newArr.push(arr[i])
}
}
return newArr;
}
console.log(filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3));