You'll need to do two things: 1) search for a country matching the name provided; 2) map the resulting country to the ISO code only. The simplest way:
const matches = countries.filter(e => e.name == '<name>');
if (matches.length > 0) {
const country = matches[0];
console.log(country.isoCode);
}
The
filter()
method loops through all entries in the array and performs a match based on the name. Then we simply check the number of matches and select the first one.
This doesn't factor in things like case-sensitivity in the country name, or account for when there's more than one result (there shouldn't be).