title: TypeError: result.push is not function
body: <p>I have these two functions, both generate a range from start to end inclusive, where start and end are integers. They look like this:</p>
  
  <pre><code>function range(start, end) {
    var result = [];
    for (var i = start; i &lt;= end; i++) {
      result.push(i);
    }
    return result;
  }
  
  console.log(range(1,5));
  //Expected output [1, 2, 3, 4, 5]
  
  function functional_range(start, end) {
    function functional_range_helper(result, strt, nd) {
      if (strt &gt; nd) return [];
      if (strt === nd) {
        return result;
      } else {
        return functional_range_helper(result.push(strt), strt + 1, nd);
      }
    }
    return functional_range_helper([], start, end);
  }
  
  console.log(functional_range(1,5));
  //Expected output [1, 2, 3, 4, 5]
  </code></pre>
  
  <p>The first one runs perfectly. The second errors out with "TypeError: result.push is not a function." I don't understand why this is happening because I'm passing an array as the first argument to the helper function and using the correct parameter name inside the helper function to reference it. It is an array, so why am I getting this error?</p>