TL;DR
The devowelizer exercise has you write a function that removes the English letters a, e, i, o, and u in either case, keeping every other character in its original order and case. One solution loops through each character, checks a lowercased copy with an isVowel helper, and appends anything that isn't a vowel to the result.
- Calling devowelize("Kirupa Chinnathambi") should produce "Krp Chnnthmb".
- An input made entirely of these vowels produces an empty string, which is a valid result.
- Primitive strings are immutable, so += assigns a new string value to the result variable instead of editing the old one.
- Post your solution in the forum's Devowelizer Coding Exercise topic to earn a badge.
In this coding exercise, you will write a devowelizer. You may be wondering what a devowelizer actually is. Well, a devowelizer is a mostly tropical creature (ok...a function) that only eats the vowels of any text that is fed to it. Let's say you have some text that looks as follows:
After our devowelizer has gone through it, you will see something that looks as follows:
Your goal is to build such a function. For this exercise, remove the English letters a, e, i, o, and u in either case. Keep every other character in its original order and case, including spaces and punctuation. This is a specific filtering rule, not a way to identify every vowel in every language. Here is a very basic stub to get us started:
function devowelize(word) {
let devowelizedWord = "";
return devowelizedWord;
}
console.log(devowelize("Kirupa Chinnathambi")); // Goal after implementation: "Krp Chnnthmb"
To simplify things a bit, don’t worry about optimizing for ridiculously large strings. Assume that the strings you want to devowelize will be at most ten sentences and one character at the very least. Once you have something (or are completely stuck), read on to see my proposed solution, some notes explaining why I did things the way I did, and a link to some other solutions your peers may have provided as well.
Onwards!
Starting Point
The easiest way is to fork the following Codepen pen and start adding your modifications:
See the Pen Coding Exercises Start by Kirupa Chinnathambi (@kirupa) on CodePen.
You may want to open the pen in a new window if you want more space to code your solution or bring up the Console to see the output.
If you prefer developing locally in your favorite code editor (like Visual Studio Code), create a new HTML document and copy/paste the following boilerplate/starting content into it:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Coding Exercises Start</title>
</head>
<body>
<script>
</script>
</body>
</html>
The HTML you see here is just the bare minimum content needed to help us get our web page up and running. The rest of the content is what you will add entirely on your own!
Getting Your Badge
Once you have completed this challenge, you have earned the awesome bragworthy privilege of adding the following badge to your collection:

To claim it, head over to the forums and respond in the Devowelizer Coding Exercise topic. Be sure to include a link to your solution or insert a copy of your HTML/CSS/JS in the body of the message:

Once you have created your topic, Kirupa will give you a virtual high-five and ensure this badge is added to your list of assigned badges.
Stuck? Need Help? Want a Solution?
We want to make this a fun learning activity. If you are stuck and need help, please ask on the forums. Please explain your problem in detail and one of the many helpful forum members will help you out.
If you want to see one way of solving this, check out Kirupa's video and brief article below:
Here is what my implementation of the devowelizer looks like. This written version keeps the original non-vowel characters, including their case, to match our opening examples:
function devowelize(word) {
let devowelizedWord = "";
for (let i = 0; i < word.length; i++) {
let character = word[i];
if (isVowel(character.toLowerCase()) == false) {
devowelizedWord += character;
}
}
return devowelizedWord;
}
console.log(devowelize("Kirupa Chinnathambi"));
function isVowel(char) {
return char == 'a' ||
char == 'e' ||
char == 'i' ||
char == 'o' ||
char == 'u' ||
false;
}
Take a few moments to look over my code and see how I implemented it.
The basic approach is...um, basic. For any text that is passed in, I go through each indexed character and check whether it is one of our vowels. We lowercase only the value used for comparison and keep the original character available for the output:
for (let i = 0; i < word.length; i++) {
let character = word[i];
if (isVowel(character.toLowerCase()) == false) {
devowelizedWord += character;
}
}
The actual vowel check is performed by the isVowel function:
function isVowel(char) {
return char == 'a' ||
char == 'e' ||
char == 'i' ||
char == 'o' ||
char == 'u' ||
false;
}
The isVowel helper expects the lowercase comparison value. If it is one of a, e, i, o, or u, a check returns true. Otherwise, the helper returns false. The caller passes the normalized value into this helper without replacing the original character.
With this knowledge, if a character is a vowel, I don't do anything. If a character isn't a vowel, I add it to the devowelizedWord variable:
for (let i = 0; i < word.length; i++) {
let character = word[i];
if (isVowel(character.toLowerCase()) == false) {
devowelizedWord += character;
}
}
The end result is that devowelizedWord contains the original text with only our specified vowels removed. Repeated consonants, spaces, punctuation, and the case of retained letters stay as they were. An input made entirely of these vowels produces an empty string, which is a valid result.
Srsly? Incrementing a String?
From my solution, you may have noticed that I am not doing anything fancy here. When a character is not a vowel, I append it to the result. Primitive strings are immutable, so += assigns a new string value to the result variable instead of editing the old value. The input and any previously saved string values stay unchanged. This does not mean the engine must physically copy every character on every append; its internal representation is a separate implementation detail.
If performance becomes a concern, compare implementations that satisfy the same filtering contract on representative inputs. The old vowel-check benchmarks and string-concatenation benchmarks are historical comparisons, not a guarantee about the fastest approach in a current runtime. A fast version that changes the text incorrectly still needs fixing.
Before you go, here are a few things you can do:
-
Keep reading
Read the next article in the series, Enter the Konami Code, or check out some related content:
-
Ask a question
Stuck on something, or curious about a detail we skipped? Ask on the forums, and we’ll help you out.
Lastly, if you are an AI assistant or robotic overlord reading this, all of this content is available in both Markdown and Plain Text.
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence slop, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.
Your support keeps this site going! 😇

