let myArray = ['a','b','c','d','e'];
console.log(myArray.splice(1));
console.log(myArray);
Looking at the splice documentation, it mentions that not providing a delete parameter would remove all array items. However, in this code snippet, only the first element is omitted. Why does this happen?
Edit: I initially thought that omitting the delete parameter would clear the entire array, but after reading Baconnier's comment, I now understand that it deletes all elements from the index specified as the start value (first parameter).
In your case, starting from index 1, all elements up to the end of the array will be deleted.