Created
December 26, 2017 08:52
-
-
Save bjdixon/b2b0cd37f6ca1cce5b713d0ad8f829e6 to your computer and use it in GitHub Desktop.
Get the key for a value in an object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getKeyByValue = (obj, value) => Object.keys(obj).find(key => obj[key] === value); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment