Skip to content

Instantly share code, notes, and snippets.

@bjdixon
Created December 26, 2017 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjdixon/b2b0cd37f6ca1cce5b713d0ad8f829e6 to your computer and use it in GitHub Desktop.
Save bjdixon/b2b0cd37f6ca1cce5b713d0ad8f829e6 to your computer and use it in GitHub Desktop.
Get the key for a value in an object
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