1function getKeyByValue(object, value) {
2 return Object.keys(object).find(key => object[key] === value);
3}
4
5
6const map = {"first" : "1", "second" : "2"};
7console.log(getKeyByValue(map,"2"));
1function getKeyByValue(object, value) {
2 return Object.keys(object).find(key => object[key] === value);
3}