Last active
February 23, 2018 00:44
-
-
Save willamesoares/9d370e0dec1650817bd470439dc015d4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function revert (arr) { | |
const len = arr.length | |
if (len === 1) { | |
return arr | |
} | |
const last = arr.splice(-1,1) | |
return last.concat(revert(arr)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment