Outline

The splice method is the one you need if you want to remove an item or items from an array. Here's an example of its use:

const numbers = [1, 2, 3];
numbers.splice(1, 1);
console.log(numbers); // [1, 3]

The method requires 1 parameter be passed, but a second is usually passed as well. The first param is the starting index where the delete should start. The second parameter is the number of items that should be deleted. If you don't pass a second parameter, every item from the starting index to the end of the array will be deleted.

The splice method also returns the items that were deleted as an array if you want to assign its return value to a variable and use the deleted items in some manner.

const numbers = [1, 2, 3];
const deleted = numbers.splice(1, 1);
console.log(numbers); // [1, 3]
console.log(deleted); // [2]
 

I finished! On to the next chapter