Why the splice mode is different after the array is deconstructed, and the resulting array is different.

let list = ["1", "2"]

let list1 = [...list].splice(0, 1)
let list2 = [...list]
list2.splice(0, 1)

console.log(list1) // ["1"]
console.log(list2) // ["2"]

Why does the chained call get the wrong result?

Dec.26,2021

the location where http://www.w3school.com.cn/js.
splice( adds / removes items, the number of items to delete, the new items added to the array), and then returns the deleted items.
let list1 = [.list] .splice (0,1) delete 1 from position 0, list1 = deleted items
list2.splice (0,1) delete 1 from position 0, list2 has the first item left, list2 = [2]

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a7f9-2c235.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a7f9-2c235.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?