JSFiddle - React, Tailwind, and code Playground

JavaScript

function reverse(arr) {
	function doReverse(a, left, right) {
  	if (left >= right) {
    	return a;
    }
    const temp = a[left];
    a[left] = a[right];
    a[right] = temp;
    left++;
    right--;
    return doReverse(a, left, right);
  }

	return doReverse(arr, 0, arr.length - 1);
}

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