JSFiddle - React, Tailwind, and code Playground

by Jessie Lau

JavaScript

function reverse (arr) {
    if (arr.length === 0) {
        return;
    } else {
        return reverse(arr.slice(1)) + arr[0];
    }
}

console.log(reverse([1,2,3]));