Today we'll look at a solution to remove all vowels in a string using Javascript
The idea is that we get a string and have to return the string without the letters aeiou
Javascript remove all vowels
let's dive into the solution
const input = 'Dev blogs';
const removeVowels = input.replace(/[aeiou]/gi,'');
console.log(removeVowels);
// Dv Blgs
The first part is to use the JavaScript replace function to replace a specific match. The first part is the match, for which we’ll use a regular expression. And the second part is the replacement.
We could say replace he letter i with an empty string like this
const removeVowels = input.replace('i','');
console.log(removeVowels);
Thank you for reading this blog