0

I have a array like this:

array = [
    ['ID','Name','Gender']
    ['1', 'John', 'Male']
    ['2', 'Mark', 'Male']
   ]

I want to delete the first array, which is ['ID','Name','Gender'] But how can I delete this array ?

Pradip Dhakal
  • 1,872
  • 1
  • 12
  • 29

2 Answers2

2

You can use shift() to remove the first array

let array = [
  ['ID', 'Name', 'Gender'],
  ['1', 'John', 'Male'],
  ['2', 'Mark', 'Male'],
]

array.shift();

console.log(array);

Doc: shift()

Eddie
  • 26,593
  • 6
  • 36
  • 58
-1

Another option is to splice()

let array = [
  ['ID', 'Name', 'Gender'],
  ['1', 'John', 'Male'],
  ['2', 'Mark', 'Male'],
]

array.splice(0, 1);

console.log(array);
Get Off My Lawn
  • 34,175
  • 38
  • 176
  • 338