How to remove vowels from a string in JavaScript?

To remove vowels from a string in JavaScript, do this: string.replace(/[aeiou]/ig, '').

Here's how you do it:

const string = 'Hello World!';

const noVowels = string.replace(/[aeiou]/ig, '');

console.log(noVowels); // Hll Wrld!