Sunday, April 3, 2022

Reverse a String in JavaScript

 A simple program asks the user to give a string and then the program will reverse the given string and display the reverse string in the alert dialog box 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>Reverse a String in JavaScript</h2>
<style>
  body {
  font-family: arial;
  }
</style>
<script type="text/javascript">
function reverse_string(form) {
var text = "";
var str = document.getElementById( 'rev_string' ).value;
for (i = 0; i <= str.length; i++)
text = str.substring(i, i+1) + text;
alert( "" + text);
}
</script>
<form>
<input type="text" size=40 id="rev_string"><br><br>
<input type="button" value="Reverse String" onClick="reverse_string(rev_string)">
</form>
</html>


No comments:

Post a Comment