const str = "The quick brown fox jumps over a lazy dog";
const vowels = str.match(/[aeiou]/gi);
const consonants = str.match(/[^aeiou]/gi);
vowels.concat([''],consonants).forEach(k => { console.log(k); } );
// 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 vowelCount = str => {
let vowels = /[aeiou]/gi;
let result = str.match(vowels);
let count = result.length;
console.log(count);
};
function countVowels(str) {
return str.match(/[aeiou]/g).length;
}
// Finding the number of vowels in a string.
// Bir string-dizideki sesli harflerin sayısını bulma.
var str = "Küçük-BÜYÜK sesli harflerden OLUŞAN bir STRİNG cümlesi";
var counter = 0;
str.split("").forEach(element => {
var sesliHarfler = ["A", "E", "I", "İ", "O", "Ö", "U", "Ü", "a", "e", "ı", "i", "o", "ö", "u", "ü"];
var str_1 = (sesliHarfler.includes(element));
if (str_1 == true) {
counter++;
console.log(counter);
};
});