how to delete last 2 elements of an array in js code example Example: javascript delete second last element of array arr.splice(arr.length - 2, 1);