I am getting back the following array below and would like to show all the matched objects based off the matched strings.
Returned Array: ["USA", "FRA", "GBR"]
Original Array:
export const COUNTRY_CODES = [
{
country: "United States of America",
code: "USA",
},
{
country: "Albania",
code: "ALB",
},
{
country: "Algeria",
code: "DZA",
},
{
country: "France",
code: "FRA",
},
....
]
My desired Output is to show the country that matches:
["United States of America", "France"]
JS:
const flatArr = ["USA", "FRA", "GBR"]
COUNTRY_CODES.find((v) => flatArr === v.country)