Answers for "find object by key name"

4

js find key by value in object

Object.keys(object).find(key => object[key] === value)
Posted by: Guest on December-30-2020
1

get object key name in js

var buttons = {
  foo: 'bar',
  fiz: 'buz'
};

for ( var property in buttons ) {
  console.log( property ); // Outputs: foo, fiz or fiz, foo
}
Posted by: Guest on May-19-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language