Use slice() to remove elements without changing the original array.
Source Code
let numbers = [1, 2, 3, 4, 5];
let withoutThree = numbers.slice(0, 2).concat(numbers.slice(3));
console.log(withoutThree); // [1, 2, 4, 5]
Use slice() to remove elements without changing the original array.
let numbers = [1, 2, 3, 4, 5];
let withoutThree = numbers.slice(0, 2).concat(numbers.slice(3));
console.log(withoutThree); // [1, 2, 4, 5]