I have a 2D array:
var array = [[\"a\", \"b\", \"c\"],[\"a\", \"b\", \"c\"],[\"a\", \"b\", \"c\"]]
I want to delete an entire column of thi
splice
is cool. It resizes the array as it removes things so you don't end up with nulls. So using splice you just have to iterate through each row and remove the right element.
var removeCol = function(arr2d, colIndex) {
for (var i = 0; i < arr2d.length; i++) {
var row = arr2d[i];
row.splice(colIndex, 1);
}
}
http://jsfiddle.net/eB8LD/