06.Vowel Count

Instructions
Output
 
  • Return the number (count) of vowels in the given string.

    We will consider a, e, i, o, and u as vowels for this Kata.

     

    function getCount(str) {
    var vowelsCount = 0;
    var yuan=["a","e","i","o",'u']
    str.split("").filter(function(x,index){
    for(var i=0;i<yuan.length;i++){
    if(x==yuan[i]){
    vowelsCount++;
    }
    }
    })
    // enter your majic here

    return vowelsCount;
    }

     

    测试:abracadabra


posted on 2017-07-25 14:43  城南北  阅读(306)  评论(0编辑  收藏  举报

导航