Get Continent Information
You can use the getContinent function to obtain information about countries in a specific continent. This function takes the continent name as input and optionally an array of specific fields to retrieve.
const { getContinent } = require('countrys-info');
// Get information about countries in a specific continent
const africaCountries = getContinent('Africa');
console.log(africaCountries);
// Get specific fields of countries in a continent
const africaFields = getContinent('Africa', ['capital_en', 'code_2', 'tld']);
console.log(africaFields);
Last updated
Was this helpful?