Sobes.tech
Middle+

/* What will be printed in the console */ const a = {}; const fn = (b) => { b.some = "1"; }; fn(a); console.log(a.some); // ?

sobes.tech AI

Answer from AI

The console will output the following line:

1

Explanation: The object a is passed to the function fn by reference. Inside the function, a new property some with the value "1" is added to the object b, which references the same object as a. Therefore, after calling fn(a), the object a already contains the property some with this value.

/* What will be printed in the console */ const a =… - sobes.tech