Created
February 12, 2020 03:29
-
-
Save zackn9ne/10c2fac1ad651bed849f86025effe0f3 to your computer and use it in GitHub Desktop.
hackkerrank challenge
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) { | |
const vowel = ['a','e','i','o','u'] | |
const foundvowels = [] | |
const foundcons = [] | |
for (i = 0; i < s.length; i++) { | |
console.log("checking" + i + "times: " + s[i]) | |
if (vowel.includes(s[i]) == true) { | |
console.log("vowel" + s[i] + "found") | |
foundvowels.push(s[i]) | |
} else { | |
console.log("consant" + s[i] + "found") | |
foundcons.push(s[i]) | |
console.log(foundcons) | |
}cache | |
} | |
console.log(foundvowels.join('\r\n')) | |
console.log(foundcons.join('\r\n')) | |
} | |
//const s = ['a', 'b', 'c', 'd', 'e', 'f'] | |
vowelsAndConsonants(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment