javascript function to return string with no vowels code example

Example 1: remove vowels from string javascript

var strings = ["bongo drums", "guitar", "flute", "double bass",
               "xylophone","piano"];
string = strings.map(x=>x.replace( /[aeiou]/g, '' ));
console.log(string);

Example 2: how to make a vowel counter in javascript

const vowelCount = str => {
  let vowels = /[aeiou]/gi;
  let result = str.match(vowels);
  let count = result.length;

  console.log(count);
};

Example 3: how to make a vowel counter in javascript

function countVowels(str) {
  return str.match(/[aeiou]/g).length;
}