How can I check if two ES2015 Map objects have the same set of (key, value) pairs?
We can assume that all the keys and values are primitive datatypes.
One approach to solve this would be to take the map.entries(), create array from it, then sort that array by keys. And do the same thing with the other map. And then loop through those two arrays to compare them. All this seams cumbersome and also very inefficient because of sorting (performance inefficiency) and because of making those arrays (memory inefficiency).
Does anybody have better idea?