Skip to content

Instantly share code, notes, and snippets.

@frectonz
Created August 14, 2023 08:43
Show Gist options
  • Save frectonz/491c91094ef28fcb76fac90d236fb485 to your computer and use it in GitHub Desktop.
Save frectonz/491c91094ef28fcb76fac90d236fb485 to your computer and use it in GitHub Desktop.
From cassidoo's August 14, 2023 newsletter
function faultyKeeb(str: string): string {
const out = [];
const vowels = ["a", "e", "i", "o", "u"];
for (const ch of str) {
if (vowels.includes(ch)) {
out.reverse();
} else {
out.push(ch);
}
}
return out.join("");
}
console.log(faultyKeeb("string"));
console.log(faultyKeeb("hello world!"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment