JavaScript program to print given string in reverse order

Views: 119   

Following program shows you how to print given string in reverse order.

var input = prompt("Please enter a string:");
var output  = input.split("").reverse().join("");
console.log("Reverse of given string is: " + output);

Output:

Please enter a string: 
hello
Reverse of given string is: olleh
On By