引用类型运算符
let a = {n : 1}; let b = a; a.x = a = {n: 2}; console.log(a.x) //undefined console.log(b.x) //{n:2}
https://blog.csdn.net/Web_J/article/details/107471318
let a={m:10,n:30} let b=a; let c=b; b.m=20; let d={...b}//相当于Object.assign 第一层对象为深拷贝,再深为浅拷贝 c={n:40}//此时c的地址不再与a,b相同 console.log(a.m) //20 console.log(a===b) //true console.log(a===c) //false console.log(b===d) //false(...运算符第一层深拷贝,如果某项还是引用类型会互相影响) console.log(b===c) //false
前端问题总结 文章被收录于专栏
总结一些前端常见的面试笔试题,来和大家分享鸭