JS: Map Equality 🚀
Test Map Equality
/* xah_map_equal(Amap, Bmap) return true if two maps have the same keys and values. Keys are compared by triple equal. Values are compared by triple equal. JS: Map Equality 🚀 http://xahlee.info/js/js_map_equality.html version 2024-04-20 */ const xah_map_equal = (Amap, Bmap) => { if (Amap.size !== Bmap.size) return false; Amap.forEach((vv, kk) => { if (!Bmap.has(kk)) return false; if (Bmap.get(kk) !== vv) return false; }); return true; }; // HHHH--------------------------------------------------- const xx = new Map([[4, "n4"], [3, "n3"]]); const yy = new Map([[3, "n3"], [4, "n4"]]); console.log(xah_map_equal(xx, yy));
JavaScript, Map Object
- JS: Map Object Tutorial
- JS: Difference, Object vs Map
- JS: Literal Expression for Map
- JS: Nested Map
- JS: Iterate Map Object
- JS: Convert Object to Map 🚀
- JS: Convert Map to Object 🚀
- JS: Map Equality 🚀
- JS: Map Filter 🚀
- JS: Swap Key Value of Map 🚀
- JS: Sort Map 🚀
- JS: Truncate Map 🚀
- JS: Map Substract 🚀
- JS: How Map Determines Uniqueness of Keys
- JS: Map Object
- JS: Map Constructor
- JS: Map.prototype