Ad
Fundamentals
Strings

For provided string return the reversed string.

Examples:
1)
Input:

abc

Output:

cba

Input:

123

Output:

321

Input:

Hello World!

Output:

!dlroW olleH
Code
Diff
  • const reverseStr = s => [...s].reverse().join("")
    
    console.log(reverseStr("Lorem ipsum dolor sit amet!"))
    • const reverseStr = str => Array.from(str).reverse().join("")
    • const reverseStr = s => [...s].reverse().join("")
    • console.log(reverseStr('hello world'));
    • console.log(reverseStr("Lorem ipsum dolor sit amet!"))