Monday, 6 February 2017

Javascript function to reverse a string - Easy Method


<!DOCTYPE html>
<html>
<head>
<script>
function myFunction(){
var str = "abcd";
var len = str.length;
for(i=len-1;i>=0;i--)
{
var str2 = str.charAt(i);
alert(str2);
}
}
</script>
</head>
<body>
<button onclick="myFunction()">Click Here</button>
</body>
</html>
Try Output Here :

No comments:
Write comments

Featured post

List of Universities in Karnataka offering M.Sc Computer Science

The post-graduate programme in Computer Science (M.Sc Computer Science) contains two academic years duration and having a four semesters....

Popular Posts

Copyright @ 2011-2016