Skip to content

Instantly share code, notes, and snippets.

@zackn9ne
Created February 12, 2020 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zackn9ne/10c2fac1ad651bed849f86025effe0f3 to your computer and use it in GitHub Desktop.
Save zackn9ne/10c2fac1ad651bed849f86025effe0f3 to your computer and use it in GitHub Desktop.
hackkerrank challenge
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