Answers for "remove last 50 element from array javascript"

C
2

remove last two elements array javascript

var arr = ['1','2','3','4'];
var amount_to_remove = 2;

arr.splice(arr.length - amount_to_remove, amount_to_remove); //['3', '4']
Posted by: Guest on October-19-2021
-1

remove last entry from array in Javascript

arr.slice(0, -1);    // returns [1,0]
Posted by: Guest on October-27-2021

Code answers related to "remove last 50 element from array javascript"

Code answers related to "C"

Browse Popular Code Answers by Language