Use Do while loop to reverse a string : while : Statement JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Statement » while »

 

Use Do while loop to reverse a string

















<HTML>
   <BODY>
   <H1>
   <SCRIPT>
      var newString = "";
      var theString = 'abcde';
      var counter = theString.length;
      do
      {
         newString += theString.substring(counter-1, counter);
         counter--;
      }
      while (counter > );
      document.write(theString + " reversed is " + newString + "!");
   </SCRIPT>
   </H1>
   </BODY>
</HTML>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Statement
» while