You are here: Home / Topics / Write the code to find the vowels

Write the code to find the vowels

Filed under: JavaScript Interview Questions on 2022-07-06 10:06:36

const findVowels = str => {  

let count = 0  

const vowels = ['a', 'e', 'i', 'o', 'u']

  for(

let char of str.toLowerCase()) {    if(vowels.includes(char)) {   

   count++

    }  }

  return count

}

About Author:
K
Kanak Sharma     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.