Intermediate Algorithm Scripting - Seek and Destroy

Tell us what’s happening:
Describe your issue in detail here.
I am really confused about this problem. When I use splice(0,1) and console.log, the result is like this: [ [ 1, 2, 3, 1, 2, 3 ] ]. I do not understand because it is supposed to start at index 0; delete 1 element in this array: [ [ 1, 2, 3, 1, 2, 3 ], 2, 3 ] and return [2,3]. Can someone explain it to me? Thank you.

   **Your code so far**
function destroyer(arr) {
 let arrs = Array.from(arguments)
console.log(arrs)
let targets = arrs.splice(0,1)
console.log(targets)
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Intermediate Algorithm Scripting - Seek and Destroy

Link to the challenge:

Array.prototype.splice() - JavaScript | MDN value

The deleted elements are returned by splice

1 Like