This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Its a simple string reverse program. without using string function. | |
function stringrev( ) | |
{ | |
var restr = ""; | |
var stname = ""; | |
var giveme = prompt("give me string", stname); | |
document.write("orignal string is :"+ " " +giveme); | |
var rev = giveme.length; | |
for(var i = rev-1; i >-1; i--) | |
{ | |
restr+= giveme.substr(i,1); | |
} | |
console.log(restr); | |
} | |
stringrev( ); |
No comments:
Post a Comment