I want to get the value of a key in a array.
arr= [
{key: "a", label: "Adam", value: "121"},
{key: "e", label: "TT", value: "44"},
{key: "ad", label: "RRR", value: "555"}
]
arr2 = ["a","e","ad"];
arr2.map((item) => {
//here value of item could be oneof the values in arr2
//say its "a"
//how do I get the value of key-"label" corresponding to the value in item???
// in this case the value of label returned should be "Adam"
result = get(arr, [item, "label"]); // is this possible??
});
Any ideas on this?? Thanks!