Tell us what’s happening:
Describe your issue in detail here.
Hi all, I just have a general question regarding using .length in nested arrays…does .length return the number of sub-arrays or the total number of elements present? e.g. for [ [ 2, 1, 3 ], [4, 1, 5], 3 ] would arr.length = 3 (two nested arrays + 3) or 7?
Your code so far
function filteredArray(arr, elem) {
let newArr = [];
// Only change code below this line
// Only change code above this line
return newArr;
}
console.log(filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15
Challenge: Basic Data Structures - Iterate Through All an Array’s Items Using For Loops
Link to the challenge: