Published
- 1 min read
remove last two elements array javascript
The solution for this is noted below
remove last two elements array javascript
Solution
var arr = ['1', '2', '3', '4']
var amount_to_remove = 2
arr.splice(arr.length - amount_to_remove, amount_to_remove) //['3', '4']
Try other methods by searching on the site. That is if this doesn’t work