传播算子,我不明白为什么输出为假?

时间:2018-09-12 10:38:07

标签: javascript arrays spread-syntax

let arr = ['Hello', 'Hi', 'How', 'do', 'you']
let x = arr;
let y = [...arr]
console.log(x) //Array ["Hello", "Hi", "How", "do", "you"]

console.log(y) //Array ["Hello", "Hi", "How", "do", "you"]

console.log(x === y) //false

console.log(arr === x) //true

console.log(arr === y) //false

0 个答案:

没有答案