1
var array = [["a", "b", "c", "d", "e", "f"],
            ["a", "b", "c", "d", "e", "f"],
            ["a", "b", "c", "d", "e", "f"]]

How can I delete the second column in this array?

John
  • 577
  • 4
  • 20

1 Answers1

3

You could specify the index and then iterate over the array and splice the inner arrays.

var array = [["a", "b", "c", "d", "e", "f"], ["a", "b", "c", "d", "e", "f"], ["a", "b", "c", "d", "e", "f"]],
    index = 1;

array.forEach(a => a.splice(index, 1));

console.log(array);
.as-console-wrapper { max-height: 100% !important; top: 0; }
Nina Scholz
  • 376,160
  • 25
  • 347
  • 392