Basic Data Structures:for loop(problem)

function filteredArray(arr, elem) {
  let newArr = [];
  let len = arr.length;
  //console.log(len);
  // change code below this line
  for(let i = 0;i<len;i++){
    //console.log(arr[i]);
    let doulen = arr[i].length;
    //console.log(doulen);
    for(let j = 0;j<arr[i];j++){
      console.log(arr[i][j]);
      if(arr[i][j] !== elem){
        newArr.push(arr[i][j]);
      }
    }
  }
  console.log(newArr);
  // change code above this line
  return newArr;
}


// change code here to test different cases:
console.log(filteredArray([[1,1,1],[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3));

Looks clean but not working

Are you sure this condition is correct for your inner loop ?

arr[j] takes the looped values of inner arrays of arr.

There was a mistake with the length of the inner array of arr

console.clear();
function filteredArray(arr, elem) {
  "use strict";
  let newArr = [];
  let len = arr.length;
  //console.log(len);
  // change code below this line
  for(let i = 0;i<len;i++){
    //console.log(arr[i]);
    let doulen = arr[i].length;
    //console.log(doulen);
    for(let j = 0;j<arr[i].length;j++){
      console.log(arr[i][j]);
      if(arr[i][j] !== elem){
        newArr.push(arr[i][j]);
      }
      
      
    }
  }
  console.log(newArr);
  // change code above this line
  return newArr;
}


// change code here to test different cases:
console.log(filteredArray([[1,1,1],[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3));

This is revised code ,its returning the values which are equal to the elem;

This is the code






function filteredArray(arr, elem) {
  "use strict";
  let newArr = [];
  let len = arr.length;
  for(let i = 0;i <len; i++){
    /* Assume that all of the elements of the subarray do not match elem (initialize a Boolean flag variable to true)*/
    if(arr[i].indexOf(elem) === -1){
      return true;
    }
    for(let j = 0;j<arr[i].length;j++){
      // Check if the current element in sub array is equal to elem.
      if(arr[i][j] === 3){
        return false;
        break;
      }
      /* If it is equal, then set the value of your flag variable to be false AND stop break out of loop*/
      } 
    }
    // If the flag variable is still true then push the sub array into newArr
 newArr.push(arr[i]);
 console.log(newArr);
  return newArr;
}
console.log(filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3));

It worked






function filteredArray(arr, elem) {
  "use strict";
  let newArr = [];
  let len = arr.length;
  let value ;
  for(let i = 0;i <len; i++){
    /* Assume that all of the elements of the subarray do not match elem (initialize a Boolean flag variable to true)*/
    if(arr[i].indexOf(elem) === -1){
     value = true;
    console.log(value);
    }
    for(let j = 0;j<arr[i].length;j++){
      // Check if the current element in sub array is equal to elem.
      if(arr[i][j] === elem){
         value = false;
         console.log(value);
         break;
      }
      /* If it is equal, then set the value of your flag variable to be false AND stop break out of loop*/
      } 
     if(value === true){
       newArr.push(arr[i]);
     } 
    }
    // If the flag variable is still true then push the sub array into newArr
  return newArr;
}
console.log(filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3));

But is it the right approach.