L really need help ..l am not understanding the question and how to create the for loops to bring the correct out come l want

**l am not managing to run any thing for my test to pass l need further explaining
**
Describe your issue in detail here.

   **Your code so far**

function filteredArray(arr, elem) {
 let newArr = [];
 // Only change code below this line
 for (let i = 0; i < arr.length; i++) {}
 // Only change code above this line
newArr.push(arr[i]);

 return newArr;
}

   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36

Challenge: Iterate Through All an Array’s Items Using For Loops

Link to the challenge:

You added code below the line that says “Only change code above this line”.

You have a for loop, but you don’t have anything in it right now. The code that is executed as part of the for loop must be between the curly braces ({}).

Judging by the assignment, you need to loop through arr (which is an array of nested arrays). If any of these nested arrays contains elem , then such nested arrays should not be pushed into newArr .

For example:
filteredArray([[10, 8, 3], [14, 6, 23], [3, 18, 6]], 18) should return [[10, 8, 3], [14, 6, 23]]
In this case, elem equals 18, and 18 is part of the third nested array within arr . Therefore, the third nested array is not returned.

Hint: You need a for loop, which contains an if .

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.