Following code may be helpful -
function is_vowel(c)
{
switch (c)
{
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':
return true;
default:
return false;
}
}
function count_vowel(str)
{
var count=0;
for (var i=0; i < str.length; i++)
{
if (is_vowel(str.charAt(i)))
{
count++;
}
}
return count;
}
function get_maxvowel(str, substrsize)
{
var maxvovelsize = 0;
for(i=0; i < (str.length - substrsize + 1) ; i++)
{
if (count_vowel(str.substr(i, substrsize)) > maxvovelsize)
maxvovelsize = count_vowel(str.substr(i, substrsize));
}
return maxvovelsize;
}