Created
September 9, 2021 07:25
-
-
Save danielchikaka/4663498941c58a56fd4a368bb2ea88b0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 findVowelsConsonants(sentence) { | |
var arr = []; | |
var arrSentence = sentence.split(''); | |
// Get all vowels | |
arrSentence.forEach(el => { | |
if(['a','e', 'i', 'o', 'u'].indexOf(el.toLowerCase()) !== -1){ | |
arr.push(el); | |
} | |
} ); | |
// Get all consonants | |
arrSentence.forEach(el => { | |
if(['a','e', 'i', 'o', 'u'].indexOf(el.toLowerCase()) === -1){ | |
arr.push(el); | |
} | |
} ); | |
// Publish | |
arr.forEach(el => console.log(el)) | |
} | |
console.log(findVowelsConsonants('daniel')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment