0% found this document useful (0 votes)
8 views1 page

Count Vowels in a String with JS

Uploaded by

ompatil372008
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Count Vowels in a String with JS

Uploaded by

ompatil372008
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Code:

<html>
<head>
<title> To count Vowels </title>
</head>
<body>
<form name = "f1">
<h1> Enter the string whose vowel is to be counted </h1>
<input type ="text" name = "t1">
<input type = "button" name = "btn_checkVowel" value = "Click to Count" onClick="count()">
</form>
<script type = "text/javascript">
function count()
{
var i,ch,str,counter=0;
str = [Link];
for (i=0;i<[Link];i++)
{
ch=[Link](i);
if (ch=="A"||ch=="a"||ch=="E"||ch=="e"||ch=="I"||ch=="i"||ch=="O"||ch=="o"||
ch=="U" || ch=="u")
counter++;
}
alert ("Number of Vowels in the Entered String are:"+counter);
}
</script>
</body>
</html>
Out Put:

You might also like