DEV Community

Discussion on: Advantages of a JavaScript Map

Collapse
 
psuranas profile image
Prateek Surana

In the first example, this returns true since Objects have no properties called keys so it is undefined for both of them.

obj1.keys === obj2.keys

The correct method for getting keys for an object is -

Object.keys(obj1) === Object.keys(obj2)

Which will be false because both the arrays have separate references.

Collapse
 
katkelly profile image
Katherine Kelly

Hi, thanks for spotting that! It’s been updated now.

Collapse
 
psuranas profile image
Prateek Surana

πŸ™Œ