Weird issue with slice() when copying an array
问题 I have an "empty" array that will be populated with data later in the code. But before it reaches that stage there's a section where the default content is copied to a temporary array, so the original can be changed and later receive the relevant data that was stored in the copy. The problem is when I use slice and delete the section in the original array, the temporary one is affected as well. var array1 = [["text", [[[1,2],[3,4],[5,6]]], 0]]; var array2 = array1[0].slice(0); //alert(array2