Created
April 21, 2020 07:02
-
-
Save ThienTranDuy/45c0dd10a77d1600c3cc21fee3d53c20 to your computer and use it in GitHub Desktop.
Hackerrank 10 Days of Javascript - vowelsAndConsonants - https://www.hackerrank.com/challenges/js10-loops/problem
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 vowelsAndConsonants(s) { | |
let vowels = ['a', 'e', 'i', 'o', 'u']; | |
let sLen = s.length; | |
for (let i = 0; i < sLen; i++) { | |
if (vowels.includes(s[i])) { | |
console.log(s[i]); | |
} | |
} | |
for (let i = 0; i < sLen; i++) { | |
if (!vowels.includes(s[i])) { | |
console.log(s[i]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment