JS: Test Equality of Map Objects 📜
Test Map Equality
/* xah_map_equal(xmapA, xmapB) 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 = (xmapA, xmapB) => { if (xmapA.size !== xmapB.size) return false; xmapA.forEach((vv, kk) => { if (!xmapB.has(kk)) return false; if (xmapB.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)); // true
JavaScript. Map Object
- JS: Map 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: Test Equality of Map Objects 📜
- 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 (class)
- JS: Map Constructor
- JS: Map.prototype