I need help displaying matching countries based on the codes provided in the returned array below.
Returned Array:
["USA", "FRA", "GBR"]
List of Countries:
export const COUNTRY_CODES = [
{
country: "United States of America",
code: "USA",
},
{
country: "Albania",
code: "ALB",
},
{
country: "France",
code: "FRA",
},
....
]
The desired Output should display the names of the matching countries:
["United States of America", "France"]
Javascript Code:
const flatArr = ["USA", "FRA", "GBR"]
COUNTRY_CODES.find((v) => flatArr === v.country)