D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
kyleshevlin
Full window
Github gist
JS Bin // source http://jsbin.com/xerotos
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>JS Bin</title> </head> <body> <script id="jsbin-javascript"> "use strict"; function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } function recursiveReverse(arr) { if (arr.length === 0) { return []; } else { var first = arr.shift(); return [].concat(_toConsumableArray(recursiveReverse(arr)), [first]); } } var myArray = [1, 2, 3, 4, 5]; console.log(recursiveReverse(myArray)); </script> <script id="jsbin-source-javascript" type="text/javascript">function recursiveReverse (arr) { if (arr.length === 0) { return [] } else { const first = arr.shift() return [ ...recursiveReverse(arr), first ] } } const myArray = [1,2,3,4,5] console.log(recursiveReverse(myArray))</script></body> </html>