Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3.     <title>Reverse a string</title>
  4.     <script type="text/javascript">
  5.    
  6.     originalString = prompt("What do you want to be reversed?")
  7.     reversedString = []
  8.    
  9.     for(i=1; (originalString.length - i) >= 0; i++)
  10.     {
  11.         reversedString.push(originalString[originalString.length - i])
  12.     }
  13.    
  14.     alert(reversedString)
  15.    
  16.     </script>
  17. </head>
  18. <body>
  19.  
  20. </body>
  21. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement