Created
August 13, 2019 17:53
-
-
Save debonx/043f87e24bc0f83de9e22ad6b2196003 to your computer and use it in GitHub Desktop.
Example of converting regular sentences into whale language.
This file contains hidden or 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
let input = 'Mi chiedi qual è stato il mio progresso? Ho cominciato a essere amico di me stesso.'; | |
const vowels = ['a', 'e', 'i', 'o', 'u']; | |
let resultArray = []; | |
for(i = 0; i < input.length; i++){ | |
//console.log(i); | |
for(j = 0; j < vowels.length; j++){ | |
if(input[i] === vowels[j]) { | |
if(vowels[j] === 'e' || vowels[j] === 'u') { | |
resultArray.push(vowels[j] + vowels[j]); | |
} else { | |
resultArray.push(vowels[j]); | |
} | |
} | |
} | |
} | |
console.log(resultArray.join('').toUpperCase()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment