Given a whole text like:
var nation = "Piazza delle Medaglie d'Oro
40121 Bologna
Italy"
And a given array like:
["Afghanistan", "Italy", "Albania", "United Arab Emirates"]
How can we check that the word Italy within that whole text is in the array
?
Following this SO answer this is what I tried, but I get False
while instead Italy is present within the array
var countries = [];
$("#usp-custom-3 option").each(function() {
var single = $(this).text();
countries.push(single);
var foundPresent = countries.includes("Piazza delle Medaglie d'Oro 40121 Bologna Italy");
console.log(foundPresent);
});