How to remove row in 2d array in javascript

Lets say you have an array 'arr' then you can remove full row by arr.splice(3,1);


Here's an example of how to remove a row by using splice:

var array = [];

var count = 0;
for (var row=0; row<4; row++) {
    array[row] = [];
    for (var col=0; col<5; col++) {
      array[row][col] = count++;
    }
}

console.log(array);

   [ [ 0,  1,  2,  3,  4  ],
     [ 5,  6,  7,  8,  9  ],
     [ 10, 11, 12, 13, 14 ],
     [ 15, 16, 17, 18, 19 ] ]


function deleteRow(arr, row) {
   arr = arr.slice(0); // make copy
   arr.splice(row - 1, 1);
   return arr;
}

console.log(deleteRow(array, 4));

[ [ 0,  1,  2,  3,  4  ],
  [ 5,  6,  7,  8,  9  ],
  [ 10, 11, 12, 13, 14 ] ]