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
  • 579
  • 6
  • 18

1 Answers1

2

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
  • 323,592
  • 20
  • 270
  • 324