xxxxxxxxxx
for( var i = 0, len_i = json.length; i < len_i; i++ ) {
for( var j = 0, len_j = json[ i ].length; j < len_j; j++ ) {
// do something with json[ i ][ j ]; (the value in the inner Array)
}
}
xxxxxxxxxx
function filteredArray(arr, elem) {
let newArr = [];
// Only change code below this line
for (let i = 0; i < arr.length; i++) {
if (arr[i].indexOf(elem) === -1) {
newArr.push(arr[i]);
}
}
// Only change code above this line
return newArr;
}
console.log(filteredArray([["amy", "beth", "sam"], ["dave", "sean", "peter"]], "peter"));