Array Reverse with Recursion

Reverse

data = [77,66,55,44,33,22,11,0]

Result

Also use data.reverse()

To Visualize: Copy code and test Click Here

Code


        let data = [77,66,55,44,33,22,11,0];
        let temp;

        function customReverse(data,start,end){
        console.log(data)
        if(start <= end){
          temp = data[start];
          data[start] = data[end];
          data[end]=temp;
          customReverse(data,start + 1, end - 1);
        }
        
      }

      customReverse(data,0,data.length-1);