Objective
In this challenge, we practice looping over the characters of string. Check out the attached tutorial for more details.
Task
Complete the vowelsAndConsonants function in the editor below. It has one parameter, a string, s, consisting of lowercase English alphabetic letters (i.e., a through z). The function must do the following:
- First, print each vowel in s on a new line. The English vowels are a, e, i, o, and u, and each vowel must be printed in the same order as it appeared in s.
- Second, print each consonant (i.e., non-vowel) in s on a new line in the same order as it appeared in s.
Input Format
Locked stub code in the editor reads string s from stdin and passes it to the function.
Output Format
First, print each vowel in s on a new line (in the same order as they appeared in s). Second, print each consonant (i.e., non-vowel) in s on a new line (in the same order as they appeared in s).
Sample Input 0
1 | javascriptloops |
Sample Output 0
1 | a |
Explanation 0
Observe the following:
- Each letter is printed on a new line.
- Then the vowels are printed in the same order as they appeared in s.
- Then the consonants are printed in the same order as they appeared in s.
Solution1
1 | /* |
Solution2
1 | function vowelsAndConsonants(s) { |
Solution3
1 | function vowelsAndConsonants(s) { |