DEV Community

[Comment from a deleted post]
Collapse
 
qm3ster profile image
Mihail Malo • Edited

Recursion:

const r = ([h,...t],o='')=>h?r(t,h+o):o; r('hello')

Recursion if we don't care about TCO:

const r = ([h,...t])=>h?r(t)+h:''; r('hello')