changing object by reference in javascript

后端 未结 0 857
無奈伤痛
無奈伤痛 2021-01-04 04:27

Consider this code:

let obj1 = {foo : \'bar\'}
let obj2 = obj1

obj2.foo = \'asd\'
console.log(obj1)   // { foo: "asd" }

obj2 = null
console.log(ob         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题