slice() vs splice() array method in JavaScript

slice()
Provides a shallow duplicate of a part of an array.
const subArr = arr.slice(1, 3);


splice()
Inserts and/or deletes elements within an array.
arr.splice(1, 0, 2, 3)