Copying code from my own text editor (Sublime) into FCC

Copying code from my own text editor (Sublime) into FCC
0

#1

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));


#2

filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3) should return [ ]

Just use one of the other tests

filteredArray([[10, 8, 3], [14, 6, 23], [3, 18, 6]], 18) should return [ [10, 8, 3], [14, 6, 23] ]


#3

I believe that empty array is the correct return value for that particular function call. All sub-arrays contain 3 so all were filtered out.