Created
February 20, 2015 19:07
-
-
Save angvishvish/77e33439846e9cc93814 to your computer and use it in GitHub Desktop.
Count the number of vowel in javascript
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 VowelCount(str) { | |
var count = str.split('').map(function (item) { | |
return item.match(/[aeiouAEIOU]/) ? item : ''; | |
}).join(''); | |
return count.length; | |
} | |
// keep this function call here | |
// to see how to enter arguments in JavaScript scroll down | |
VowelCount(str); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment