How to remove element from array
Tags: Date: Tuesday 09/08/2022
- we can change the length of the array
const arr = [1,2,3,4]
arr.length = 2
- Array.pop() - will remove the last element and return it
- Array.shift() - will remove the first element and return it
- Array.splice()
const arr = [1,2,3,4]
arr.splice(1,1)
There are some other methods, this is only the basics.