---
description: Destroy method of array helpers
---

# $.array.destroy

Destroy method is a method for deleting any element from array, one or multiple elements at the same time. This destroy method support multiple delete data, you can delete them by index, delete object by its property, delete the first element of array or delete the last element of array.

#### Delete the first or the last element of array

```
// delete the first
const fromArray = ['a', 'b', 'c', 'd', 'e', 'f']
$.array.destroy(fromArray, 'first')
//=> ['b', 'c', 'd', 'e', 'f']
// or
// delete the last
$.array.destroy(fromArray, 'last')
//=> ['a', 'b', 'c', 'd', 'e']
```

#### Delete by indexes

```
$.array.destroy(fromArray, 0, 2, 3, 5)
//=> ['b', 'e']
```

#### Delete by objects

```
$.array.destroy(fromArray, {id: 6}, {id: 9})
//or
$.array.destroy(fromArray, {id: 6}, 'first', 'last', 2)
```

