0

Is it significant to an understanding of variables, memory, of primitive v.s. referential data-types that samely-typed objects can never be considered 'the same' but samely-typed primitives can?

console.log(5 === 5);

console.log({num: 1} === {num: 1});

//I'm aware that:

o = {num: 1}
o2 = o;
console.log(o === o2);//returns true

P.s. Genuine question, am hoping to get a better core understanding of JS as it seems to help so much later on to have this.

  • if you are thinking of objects, `o2` is actually `o` as it is defined to equal it, in your first case it´s obviously two different objects with the same properties and values – john Smith Jul 28 '20 at 21:09
  • What do you mean by "*samely-typed objects*"? There is only one "object type". – Bergi Jul 28 '20 at 23:21

0 Answers0