I have been trying to get the top `n` languages in an array of country objects and return the top `n` languages as an object of the language and it's count value. I tried using two loops, one nested in the other but I got stuck.
Here is a short example of the array of country Objects...

```js
const countries = [
{
 name: 'Afghanistan',
 capital: 'Kabul',
 languages: ['Pashto', 'Uzbek', 'Turkmen'],
 population: 27657145,
 flag: 'https://restcountries.eu/data/afg.svg',
 currency: 'Afghan afghani'
},
{
 name: 'Åland Islands',
 capital: 'Mariehamn',
 languages: ['Swedish'],
 population: 28875,
 flag: 'https://restcountries.eu/data/ala.svg',
 currency: 'Euro'
},
{
 name: 'Albania',
 capital: 'Tirana',
 languages: ['Albanian'],
 population: 2886026,
 flag: 'https://restcountries.eu/data/alb.svg',
 currency: 'Albanian lek'
},
{
 name: 'Algeria',
 capital: 'Algiers',
 languages: ['Arabic'],
 population: 40400000,
 flag: 'https://restcountries.eu/data/dza.svg',
 currency: 'Algerian dinar'
},
{
 name: 'American Samoa',
 capital: 'Pago Pago',
 languages: ['English', 'Samoan'],
 population: 57100,
 flag: 'https://restcountries.eu/data/asm.svg',
 currency: 'United State Dollar'
},
{
 name: 'Andorra',
 capital: 'Andorra la Vella',
 languages: ['Catalan'],
 population: 78014,
 flag: 'https://restcountries.eu/data/and.svg',
 currency: 'Euro'
},
{
 name: 'Angola',
 capital: 'Luanda',
 languages: ['Portuguese'],
 population: 25868000,
 flag: 'https://restcountries.eu/data/ago.svg',
 currency: 'Angolan kwanza'
},
{
 name: 'Anguilla',
 capital: 'The Valley',
 languages: ['English'],
 population: 13452,
 flag: 'https://restcountries.eu/data/aia.svg',
 currency: 'East Caribbean dollar'
},const countries = [
{
 name: 'Afghanistan',
 capital: 'Kabul',
 languages: ['Pashto', 'Uzbek', 'Turkmen'],
 population: 27657145,
 flag: 'https://restcountries.eu/data/afg.svg',
 currency: 'Afghan afghani'
},
{
 name: 'Åland Islands',
 capital: 'Mariehamn',
 languages: ['Swedish'],
 population: 28875,
 flag: 'https://restcountries.eu/data/ala.svg',
 currency: 'Euro'
},
{
 name: 'Albania',
 capital: 'Tirana',
 languages: ['Albanian'],
 population: 2886026,
 flag: 'https://restcountries.eu/data/alb.svg',
 currency: 'Albanian lek'
},
{
 name: 'Algeria',
 capital: 'Algiers',
 languages: ['Arabic'],
 population: 40400000,
 flag: 'https://restcountries.eu/data/dza.svg',
 currency: 'Algerian dinar'
},
{
 name: 'American Samoa',
 capital: 'Pago Pago',
 languages: ['English', 'Samoan'],
 population: 57100,
 flag: 'https://restcountries.eu/data/asm.svg',
 currency: 'United State Dollar'
},
{
 name: 'Andorra',
 capital: 'Andorra la Vella',
 languages: ['Catalan'],
 population: 78014,
 flag: 'https://restcountries.eu/data/and.svg',
 currency: 'Euro'
},
{
 name: 'Angola',
 capital: 'Luanda',
 languages: ['Portuguese'],
 population: 25868000,
 flag: 'https://restcountries.eu/data/ago.svg',
 currency: 'Angolan kwanza'
},
{
 name: 'Anguilla',
 capital: 'The Valley',
 languages: ['English'],
 population: 13452,
 flag: 'https://restcountries.eu/data/aia.svg',
 currency: 'East Caribbean dollar'
}]

```

And this is what I'm expecting to get

```js

// My output should look like this
console.log(mostSpokenLanguages(countries, 5))
/*[
{country: 'English',count:91},
{country: 'French',count:45},
{country: 'Arabic',count:25},
{country: 'Spanish',count:24},
{country:'Russian',count:9}
]*/

```

This is what I tried

```js

const mostSpokenLanguage = (arr, count) => {
let languageCountObjArr = [];
let languagesArr = arr.map(countryObj => countryObj.languages);
console.log('Languages Array', languagesArr);
languagesArr.forEach(languageArr => {
 for (let i = 0; i < languageArr.length; i++) {
   /* I GOT STUCK HERE
     let langObj = {
     country: languageArr[i],
     count: 1
   };
   if (languageCountObjArr[i].country === languageArr[i]) {
     let
   }*/
   languageCountObjArr.push(langObj);
 }
});
languageCountObjArr = languageCountObjArr.slice(count);
return languageCountObjArr;
};

```

I just started JavaScript a couple of weeks now and this stuff has been giving me worries. Please I would be very happy if I can get the answer to this question.