Use the following function to reverse the string using javascript
Example : reverseStr('KnowledgeParlour')
Output : 'ruolraPegdelwonK'
Javascript :
function reverseStr(str)
{
if (!str) return; // nothing to change
var rstr = '';
for (i=str.length-1;i>=0;i--)
{
rstr += str.charAt(i);
}
return rstr;
}
No comments:
Post a Comment