here is the question
You need to loop through the array and check if each word has more than one "o".
Here is a function to verify the word:
const verif=(word)=>{
var s=0
var l=word.length
for(let i=0 ; i<=l;i++) {
if (word[i]=="o") {
s++
}
}
if (s>=2) {
return true
} else {
return false
}
}
You can create a function a iterate through each array element
function filterArray(arr, fn) {
let filteredArray = [];
for (let i = 0; i < arr.length; ++i) {
if (fn(arr[i]) === true) {
filteredArray.push(arr[i]);
}
}
return filteredArray;
}
function isIsogram (str) {
return !/(.).*\1/.test(str);
}
const arr = ["Facebook", "Google", "Microsoft", "Apple", "IBM", "Oracle", "Amazon"];
console.log(filterArray(arr, isIsogram));