Skip to content

Instantly share code, notes, and snippets.

@ebc-2in2crc
Created December 2, 2012 12:57
Show Gist options
  • Select an option

  • Save ebc-2in2crc/4188512 to your computer and use it in GitHub Desktop.

Select an option

Save ebc-2in2crc/4188512 to your computer and use it in GitHub Desktop.
意味無く再帰で配列をリバースしてみる
function reverse(arr) {
return arr.length === 0 ?
arr :
[arr.pop()].concat(reverse(arr));
}
var a = [1, 10, 100, 20, 0];
console.log(a);
console.log(reverse(a));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment