Use recursion to generate range of numbers in ascending order using javascript

Recursion to generate range of numbers

function rangeOfNumbers(startNum, endNum) {
   const intArray = [];
     if(startNum <=  endNum ) {            
               const intArray = rangeOfNumbers(startNum, endNum-1);           
                intArray.push(endNum);     
                if(startNum > endNum) {
                        return;
                 }
               return intArray;
     } else {
       return intArray;
     }
 };