How it Works
To translate any word to "Whale-ese" simply remove all the consonants. ONce you are left with only vowels, double any letter e's and u's. That's it.
This app started as a simple javascript project for one of Codecademy's JavaScript projects. I've simply built on that idea and created this app using plain JavaScript, basic HTML and CSS.
The app listens for two events, click and keydown. The keydown event specifically listens for the "enter" key to be pressed. If either event occurs, the program checks the text input for a value and returns a result based on three conditions: Empty: asks for a word, No Vowels: returns no vowel message, and Proper Value: proceeds with the program. If the proper value is in the text input the app iterates through each letter and compares it with an array of vowels. If a letter matches a letter from the vowels array it will be stored in a new array. Should the letter that matches be an 'e' or an 'u' that letter is stored again creating a double. Once it is completed the results are added to the translator__results div using the innerHTML method and the text input is cleared and ready for another round.