Last active
May 29, 2019 15:31
-
-
Save nilz3ro/6b3ba29fe3b496239225 to your computer and use it in GitHub Desktop.
es6, recursion, rest and spread operators, destructuring and default parameter value.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const reverse = (enumerable, sorted=[]) => { | |
let [head, ...tail] = enumerable; | |
return head === undefined | |
? sorted.join('') | |
: reverse(tail, [head, ...sorted]) | |
; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment