Finds the first key in a Map that corresponds to the specified value.
Map
The first key whose value strictly equals (===) the searchValue, or undefined if no match is found.
===
undefined
const myMap = new Map<string, number>([['a', 1], ['b', 2], ['c', 1]]);getMapKeyByValue(myMap, 1); // → 'a'getMapKeyByValue(myMap, 3); // → undefined
The type of keys in the map.
The type of values in the map.
The map to search.
The value to find the corresponding key for.
Generated using TypeDoc
Finds the first key in a
Mapthat corresponds to the specified value.Returns
The first key whose value strictly equals (
===) the searchValue, orundefinedif no match is found.Example
Remarks
===).