javascript

JavaScript to find & count Vowels in a String

Let’s write a simple JavaScript to count the number of vowels present in a string and print it.

And also you will learn the below ideas from this JavaScript tutorial, such as:
1. How to define an array in JavaScript
2. How to find the length of a String in JavaScript
3. How to create a function and call it in JavaScript
4. How to loop through string characters in JavaScript

Before writing the entire code, here is the JavaScript function:

Now, let’s write the entire JavaScript example snippet to count the number of vowels in a String:

I have used bootstrap to make the page look neat, you can skip it if you don’t want.

You can see the demo of above JavaScript here:

demo

Related Posts

Leave a Reply