Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Get value with key of object in an array (javascript)

$
0
0

How can I get the value for an object in an array if I know it's key?

const array1 = [  {a: ['A1','A2']},  {b: ['B1','B2']},  {c: ['C1','C2']},]

For example, I'd like to print the value for the object with the 'a' key value which would equal:

['A1','A2']

Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>