I have asked my doubts in the following Js code as comments? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have asked my doubts in the following Js code as comments?

https://code.sololearn.com/WhRPKZAxugpP/?ref=app

7th Dec 2021, 3:40 AM
King
King - avatar
13 Answers
+ 7
var a={}, b={}; Here <a> and <b> refers to different object. Even though both are initialized as empty objects (looking similar), they are actually two individual objects. console.log(a===b); // false a = b = {}; Here <a> and <b> refers to the same object, an empty object. <a> and <b> shares the same object reference. console.log(a===b); // true Hth, cmiiw
7th Dec 2021, 4:16 AM
Ipang
+ 1
1. You have a property in India, and I have a property in Russia, and they are both empty. Will they be the same?☺️ 2. It is impossible to build two objects at the same time in the same place.
7th Dec 2021, 4:17 AM
Solo
Solo - avatar
+ 1
Krs 7, here is the keyword LOCATION
7th Dec 2021, 4:36 AM
Solo
Solo - avatar
+ 1
Krs 7 where did I gotcha... ?
7th Dec 2021, 4:45 AM
Solo
Solo - avatar
+ 1
Krs 7, let's not go for idle chatter and remove any comments that are not relevant to this issue.
7th Dec 2021, 5:08 AM
Solo
Solo - avatar
+ 1
My: "You have a property in India, and I have a property in Russia, and they are both empty. Will they be the same?☺️" Is yours: "Vasiliy they may be same in terms of size,capital. But may differ in type of soil and location." My: "Krs 7, here is the keyword LOCATION" Is yours: "Vasiliy gotcha...." My: "Krs 7 where did I gotcha... ?" Is yours: "Vasiliy what are you saying dude?" Krs 7 Now it is clear?
7th Dec 2021, 5:24 AM
Solo
Solo - avatar
+ 1
Krs 7, no, you still did not understand correctly, I only answer you to your appeals to me.
7th Dec 2021, 5:36 AM
Solo
Solo - avatar
+ 1
Because they are empty objects, and not the same empty object. a = {} // One empty object b = {} // A diferent empty object So: a == b is true, because they are indeed equal - Two empty objects a === b is false, because each one is one object The main concept at stake here is the difference between *value* and *reference*. a and b have the same value, but each has its own reference, meaning they are in different memory locations.
7th Dec 2021, 11:40 AM
Emerson Prado
Emerson Prado - avatar
0
Vasiliy they may be same in terms of size,capital. But may differ in type of soil and location.
7th Dec 2021, 4:31 AM
King
King - avatar
0
Vasiliy gotcha....
7th Dec 2021, 4:39 AM
King
King - avatar
0
Vasiliy what are you saying dude?
7th Dec 2021, 4:46 AM
King
King - avatar
0
Vasiliy ok fine I was just simply texting.
7th Dec 2021, 4:58 AM
King
King - avatar
0
Vasiliy you told no need to chat in IDE but now you're spamming any way I got it.
7th Dec 2021, 5:26 AM
King
King - avatar