push to array with spread operator but last elemts delete code example
Example 1: splice last element from array javascript
array.splice(-1,1)
Example 2: javascript remove last element from array
var arr = [1,0,2];
array.splice(-1,1)
var arr = [1,0,2];