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