Skip to content

Instantly share code, notes, and snippets.

@nilz3ro
Last active May 29, 2019 15:31
Show Gist options
  • Save nilz3ro/6b3ba29fe3b496239225 to your computer and use it in GitHub Desktop.
Save nilz3ro/6b3ba29fe3b496239225 to your computer and use it in GitHub Desktop.
es6, recursion, rest and spread operators, destructuring and default parameter value.
'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