Js reference type array problem

two equal arrays, how do I add / remove elements to one array without changing the other?

Feb.28,2021

b=a.slice ()


lodash clonedeep, learn about


Deep copy, shallow copy


if it is just an array and the original two refer to each other, you need to re-assign an equivalent new array to the variable to be operated on (deep copy one, but the two arrays are no longer equal, but the elements are the same)
for example, if an is the original array and b is the array to be operated, you can execute

.
    b=a.concat([])
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-1eb7257-262b.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-1eb7257-262b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?