non equals arrays changing values at same time javascript
问题 Please check the following... var arr = [["test", 1], ["test", 3], ["test", 5]] var otherArr = arr.slice(0) //should be a new array with a copy of arr When i evaluate arr === otherArr the result is FALSE . When i do the following, trying to change first array value: otherArr[0][1] = otherArr[0][1] + 5; it also changes the original array (arr) arr[0][1] === otherArr[0][1] evaluates to TRUE but arr === otherArr evaluates to FALSE Please help me understand this to avoid it. 回答1: This is best