0
I have asked my doubts in the following Js code as comments?
13 Respuestas
+ 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
+ 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.
+ 1
Krs 7, here is the keyword LOCATION
+ 1
Krs 7 where did I gotcha... ?
+ 1
Krs 7, let's not go for idle chatter and remove any comments that are not relevant to this issue.
+ 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?
+ 1
Krs 7, no, you still did not understand correctly, I only answer you to your appeals to me.
+ 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.
0
Vasiliy they may be same in terms of size,capital. But may differ in type of soil and location.
0
Vasiliy gotcha....
0
Vasiliy what are you saying dude?
0
Vasiliy ok fine I was just simply texting.
0
Vasiliy you told no need to chat in IDE but now you're spamming any way I got it.