Uncaught TypeError: country.languages.forEach is not a function
when trying this code:
var arrayLanguage = [];
country["languages"].forEach(function (element) {
arrayLanguage.push(element["name"]);
});
self.selectedLanguage = country["languages"].length > 0 ? arrayLanguage.join(", ") : "N/A";
I was trying to realise a searchbar input field where independent of the language used (e.g. Germany, Germania, Deutschland,...) through typing in a country's name into the searchbox input field the right country name will be found and shown - I'm using the restcountries api.
Any ideas how I could adapt the code?