we use Array.splice() to get the part of spliced, I wonder how I can get the remained part, without create another variable and let it = Array.splice().
Your code so far
const arr = [2, 4, 5, 1, 7, 5, 2, 1];
// Only change code below this line
arr.splice(1, 4);
// Only change code above this line
console.log(arr);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36
const arr = [1,2,3,4,5,6,7]
const removed = arr.splice(1, 4)
console.log(removed); //array with the removed elements
console.log(arr); // array with remaining elements