Last active
          July 14, 2016 15:44 
        
      - 
      
- 
        Save vigor-rus/2bea0e386ba0d15339c90abb304876f7 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 getCount(words) { | |
| var words = (typeof words == 'string') ? words : '', | |
| count = re => (words.match(re) || []).length, //when match fails to match, it returns null | |
| vowels = count(/[aeiou]/ig), //g - return all matches, not only the first one | |
| consonants = count(/[bcdfghjklmnpqrstvxzwy]/ig); | |
| return {vowels, consonants}; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment