// check the word is vowel or not
let words = "aeiou";
let newWords = "";
function isVowelOrNot(words) {
for (let word of words) {
if (
word === "a" ||
word === "e" ||
word === "i" ||
word === "o" ||
word === "u"
) {
newWords = newWords + word;
}
}
if (newWords === words) {
return true;
} else {
return false;
}
}
let result = isVowelOrNot(words);
console.log(result);
const encode = (string) => {
let newStringArray =string.split("").filter(
(ch) => ch === "a" || ch === "e" || ch === "i" || ch === "o" || ch === "u"
);
return newStringArray;
};
encode('football').forEach(vowel=>{
console.log(vowel);
})
//o
//o
//a