0

If I do:

const o1 = {};
const o2 = {};

is it guaranteed that o1===o2 is false?

njlarsson
  • 2,128
  • 1
  • 18
  • 27
  • 2
    The alternative would be that `o1.foo = 123` would also alter `o2`, which someone would have noticed by now. – jonrsharpe Apr 30 '21 at 09:14
  • 2
    Yes, it's guaranteed. Both variables point to a different memory location. Since comparison on objects is based on whether both objects refer to the same memory location, the code you've shown can never be `true`. – connexo Apr 30 '21 at 09:15

0 Answers0