Printing the number or string in Reverse order without for/while loop using Javascript.

vishalneeraj-24503
Posted by vishalneeraj-24503 under JavaScript category on | Points: 40 | Views : 350
<script type="text/javascript">
function Reverse(str)
{
alert('original string:-' +str);
alert('reveresed string:-' +str.split("").reverse().join(""));
}
</script>

<asp:Button ID="Button1" runat="server" Text="Button"
OnClientClick="Reverse('12345'); return false;" />

<asp:Button ID="Button2" runat="server" Text="Button"
OnClientClick="Reverse('vishalkumar'); return false;" />

output:-54321
ramuklahsiv

Comments or Responses

Login to post response