Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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']
 
PREVIOUS NEXT
Tagged: #remove #elements #array #javascript
ADD COMMENT
Topic
Name
3+1 =