+ 2
Reversing a String in JavaScript
How would one reverse a String in JavaScript?
1 Odpowiedź
+ 5
var string = “yourString”;
var stringArray = string.split(“”);
stringArray.reverse();
string = stringArray.join(“”);
Or to shorten it
string = string.split(“”).reverse().join(“”);