We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 2: Loops
Day 2: Loops
Sort by
recency
|
768 Discussions
|
Please Login in order to post a comment
This is mine
const isVowel = (caracter) => ['a','e','i','o','u'].includes(caracter); const printVowel = (caracter) => isVowel(caracter) && console.log(caracter); const printConsonant = (caracter) => !isVowel(caracter) && console.log(caracter); const textLength = (text) => text.length;
const mapText = (text, vowel) => { var i = 0; while(i < textLength(text)){ vowel ? printVowel(text[i]): printConsonant(text[i]);
i++; } }
function vowelsAndConsonants(s) {
mapText(s, true); mapText(s, false); }
THIS IS MINE:
To add to the multiple solutions posted, this was my method:
function vowelsAndConsonants(s) {
}