function filteredArray(arr, elem) { let newArr = []; // Only change code below this line // arr.length = 4 for(let i = 0; i < arr.length; i += 1){ //["flutes", 4] ()=== arr[1])--> 2 is not showing up ...i dont understand???? if(arr[i].indexOf(elem) === -1){ newArr.push(arr[i]); } } // Only change code above this line return newArr; } console.log(filteredArray([["trumpets", 2], ["flutes", 4], ["saxophones", 2]], 2));
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter