Skip to main content
Commonmark migration
Source Link

#JavaScript (ES 6), 59 50 bytes

JavaScript (ES 6), 59 50 bytes

9 Bytes thanks to Hedi and Huntro.

f=(s,n=1)=>s[n]?s+f([...s].reverse().join``,n+1):s

recursive function.

Reversing the string takes almost half of the size (25 22 bytes!) ...
Why isn´t there a native way for that?

#JavaScript (ES 6), 59 50 bytes

9 Bytes thanks to Hedi and Huntro.

f=(s,n=1)=>s[n]?s+f([...s].reverse().join``,n+1):s

recursive function.

Reversing the string takes almost half of the size (25 22 bytes!) ...
Why isn´t there a native way for that?

JavaScript (ES 6), 59 50 bytes

9 Bytes thanks to Hedi and Huntro.

f=(s,n=1)=>s[n]?s+f([...s].reverse().join``,n+1):s

recursive function.

Reversing the string takes almost half of the size (25 22 bytes!) ...
Why isn´t there a native way for that?

added 51 characters in body
Source Link
Titus
  • 14.8k
  • 1
  • 24
  • 41

#JavaScript (ES 6), 5959 50 bytes

9 Bytes thanks to Hedi and Huntro.

f=(s,n=1)=>n<s.length=>s[n]?s+f(s[.split``..s].reverse().join``,n+1):s

recursive function.
Reversing

Reversing the string takes almost half of the size (25 22 bytes!) ... Why
Why isn´t there a native way for that?

#JavaScript, 59 bytes

f=(s,n=1)=>n<s.length?s+f(s.split``.reverse().join``,n+1):s

recursive function.
Reversing the string takes almost half of the size ... Why isn´t there a native way for that?

#JavaScript (ES 6), 59 50 bytes

9 Bytes thanks to Hedi and Huntro.

f=(s,n=1)=>s[n]?s+f([...s].reverse().join``,n+1):s

recursive function.

Reversing the string takes almost half of the size (25 22 bytes!) ...
Why isn´t there a native way for that?

Source Link
Titus
  • 14.8k
  • 1
  • 24
  • 41

#JavaScript, 59 bytes

f=(s,n=1)=>n<s.length?s+f(s.split``.reverse().join``,n+1):s

recursive function.
Reversing the string takes almost half of the size ... Why isn´t there a native way for that?