= {};
abc.a = "aaa";
this.abc = abc;
abc.b = "bbb";
Will this.abc now also contain b?
Language: JS Source: const test1 = {}; test1.a = "aaa"; const test2 = test1; test1.b = "bbb"; console.log(test2); Result: { a: 'aaa', b: 'bbb' }
Because objects are pass-by-reference
Обсуждают сегодня