0

String reverse function in JavaScript

JavaScript
function reverseString(s){
    return s.split("").reverse().join("");
}

console.log(reverseString("Hello")) ;//"olleH"
RUN
JavaScript
const solution = (str) => str.split("").reverse().join("");

console.log(solution("coderatings")); // "sgnitaredoc"
RUN
JavaScript
console.log("my example text".split("").reverse().join(""));
RUN
add comment
Suggest a different solution or add another example