Created
December 10, 2014 00:23
-
-
Save rafinskipg/d4fa98b53bcea9eafbf9 to your computer and use it in GitHub Desktop.
Add prefix
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
var word = "poop"; | |
function getPrefix(word){ | |
var vowels = ['a','e','i','o','u']; | |
return vowels.indexOf(word.charAt(0)) != -1 ? 'an' : 'A'; | |
} | |
console.log(getPrefix(word) + ' ' + word); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment