Why the var count increasing in the code ?? however i mentioned if(vowel.indexOf(item !== -1)).
document.write('<pre>');
function func7solve(str)
{
var vowel= "aeiouAEIOU";
var arr = str.split("");
var count = 0;
arr.forEach(function(item)
{
document.write(item+"\n");
document.write(vowel.indexOf(item)+"\n");
document.write(count+"\n");
if(vowel.indexOf(item !== -1))
{
count++;
}
});
return count;
}
document.write(func7solve("The quick brown fox"));
document.write('</pre>');