0

Why both {}=={} and {}==={} are false?

15th Apr 2017, 10:59 AM
Pradipta Roy
Pradipta Roy - avatar
2 Antworten
+ 8
Objects are compared not by their contents but by their references in memory. And since every single created object in memory has a unique reference, comparing them will always yield false.
16th Apr 2017, 2:15 PM
Benneth Yankey
Benneth Yankey - avatar
+ 4
Because == and === works just for primitive types. Also, whenever you create an object it's associated with a __proto__ object which is unique for every object.
15th Apr 2017, 11:04 AM
Ashwani Kumar
Ashwani Kumar - avatar