remove element form end of array code example
Example 1: javascript delete second last element of array
arr.splice(arr.length - 2, 1);
Example 2: js delete all from array
var list = [1, 2, 3, 4];
function empty() {
//empty your array
list.length = 0;
}
empty();
Example 3: take off element form end of array
const colors = ["Blue", "Green", "Red", "Yellow"];
colors.pop();
console.log(colors); // ["Blue", "Green", "Red"]