2020-12-31

Passing in the key and returning the object javascript

With a JSON array structured like this one,

"object1": {
  "key1": "value1"
  "key2": "value2"
}
"object2": {
  "key3": null
  "key4": null
}
}

Could I pass in the key eg. key3 and get returned the object it is part of eg. object2?

I know this would be possible with a for loop, but I have a lot of keys so I am wondering if there is another way.

Thanks



from Recent Questions - Stack Overflow https://ift.tt/2WYPKMk
https://ift.tt/eA8V8J

No comments:

Post a Comment