SQL PHP HTML ASP JavaScript articles and free scripts to download
JavaScript Tutorials
Popular Tutorials
Drop down list
Timer function
JavaScript Tutorials
String
Array
Date & Time
Form Validation
Event Handling
Math Functions
JavaScript Forum
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

 
 

String reversal using charat and length property

We can reverse a string by using charat and length property of string functions in JavaScript. By using length property we will find out the total length of the string and then we will use one for loop we will print one by one character from last point using charat function.

Here is the code

<script type="text/javascript">

var my_str="Welcome to www.plus2net.com"

var i=my_str.length;
i=i-1;

for (var x = i; x >=0; x--)
{
document.write(my_str.charAt(x));

}

</script>
Further readings
Lower case text to Uppercase text
Uppercase letter to Lower case
Bold text letters using JavaScript
String Length
Character at a location using charat function
Indexof function
String Reverse function
search():Searching String inside another string
slice():Collecting part of a string using slice function
Domain and userid part of email address
Text box onBlur click event changing text case
 
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript