Sunday, April 3, 2022

Remove Consonants in a String in JavaScript

 A simple program asks the user to give a string and then the program will remove the consonants in the given string using JavaScript programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg


=================================================

Want to support my channel?


GCash Account


Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada





Program Listing

<html>

<h2>Remove Consonants in a String in JavaScript</h2>

<style>

  body {

  font-family: arial;

  }

</style>

<script type="text/javascript">


function Remove_Consonants(str) {

var str = document.getElementById( 'rev_cp' ).value;

  var strArr = str.split('');

  for (var x = 0; x < str.length; x++) {

    var char = str[x].toLowerCase();

    if (char == "a" || char == "e" || char == "i" || char == "o" || char == "u") {

      

    } else {

      strArr[x] = '';

    }

  }

  alert( "" + strArr);

  return strArr.join('');

}


</script>

<form>

<input type="text" size=40 id="rev_consonants"><br><br>

<input type="button" value="Remove Consonants String" onClick="Remove_Consonants(rev_consonants)">

</form>

</html>


 

No comments:

Post a Comment