Loading...
「ツール」は右上に移動しました。
利用したサーバー: wtserver1
2いいね 10 views回再生

learning javascript #coding #programming #javascriptforbeginners #javascripttutorial

What’s the Output? JavaScript Object Reference
Let’s solve an object reference puzzle. What do you think the output will be?
const obj1 = { a: 1 };
const obj2 = obj1;
obj2.a = 2;

console.log(obj1.a); // Output?
Explanation:

Both obj1 and obj2 reference the same object in memory. Modifying obj2.a also changes obj1.a, so the output is 2.

#coding
#javascriptframework
#javascript
#javascripttutorial
#inputoutput

コメント