Skip to content
Advertisement

To find words starting with vowels

I am trying to pickout the words that start with vowels from given list. I am having issue when the starting letter of word is a capital vowel. I am trying below code, can anyone explain why I am not getting desired output.

JavaScript

Advertisement

Answer

The expression ('aeiou' or 'AEIOU') evaluates to just 'aeiou'. Thus you end up testing for lower case vowels only. For the reason, see How do “and” and “or” act with non-boolean values?

Instead, you wanted to say

JavaScript

or

JavaScript

or

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement