Created
August 14, 2023 08:43
-
-
Save frectonz/491c91094ef28fcb76fac90d236fb485 to your computer and use it in GitHub Desktop.
From cassidoo's August 14, 2023 newsletter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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