$3.29

Who can explain to me the solution of the following?

Ask a question+
2
function logMatrix(matrix) {
  matrix.forEach(function(row) {
    console.log("\n",row.join("\t\t"));
  });
  console.log("\n\n\n");
}

const matrix = [
  [1,5,1,8,7,4,1],
  [2,null,3,2,null,1,1],
  [9,6,1,null,1,1,1],
  [3,1,2,1,6,7,1],
  [1,null,1,8,9,8,1],
  [1,7,7,null,null,null,7]
];


function bubbleNulls(matrix){
  ///
}

logMatrix(matrix)
add comment

1 Answer

0
function bubbleNulls(matrix) {
            matrix.forEach((row, rowId) => {
                matrix[rowId] = row.filter(el => el)
            })
        }
bubbleNulls(matrix);
add comment

Your Answer