Within an array of objects how does one find an object by a certain key name?

I have an an array of Object instances where each object’s own enumerable keys are based on digits only.

[{
  '2': [1, 3],
}, {
  '3': [1, 4],
}, {
  '4': [2, 6],
}]

I need to find the first array item of the first object which owns the digit based key that is provided as the base of my search.

Expected results:

  • providing the key value of 4 the expected result equals the number value 2.
  • providing the key value of 3 the expected result equals the number value 1.

158 thoughts on “Within an array of objects how does one find an object by a certain key name?”

  1. With havin so much written content do you ever run into any issues of plagorism or
    copyright violation? My blog has a lot of unique content I’ve either authored
    myself or outsourced but it looks like a lot of it is popping it up all
    over the internet without my authorization. Do you know any ways to
    help protect against content from being stolen? I’d genuinely appreciate it. http://herreramedical.org/acyclovir

    Reply

Leave a Comment