Suppose to have two Map objects, how to check if their keys sets are the same?
For example:
const A = new Map();
A.set('x', 123);
A.set('y', 345);
const B = new Map();
B.set('y', 567);
B.set('x', 789);
const C = new Map();
C.set('x', 121);
C.set('y', 232);
C.set('z', 434);
in this case both A
and B
maps have the same key set (which is ['x', 'y']
), while the key set of C
is different since it has the extra key z
.