title: javascript recursion error - function within a function
body: <p>I've got the following function:</p>
  
  <pre><code>function getRange() {
  
      // generate a range of values from value up to climit
      // excluding climit
      var countup = function(value, climit) {
          if (value &lt; climit) {
              console.log(value);
              return countup(value + 1, climit);
          }
      };
  
     // gather input from the form
     var x = document.getElementById("range_form").range_x.value;
     var y = document.getElementById("range_form").range_y.value;
  
     // Validate the input
      if (isNaN(x) || isNaN(y)) {
          console.log("Both values have to be integers!!!");
      } else {
          // run the countup fonction
          countup(x, y);
      }
  }
  </code></pre>
  
  <p>Now function countup (on its own) works as expected by me. Once I've put it within the getRange function, it stopped working properly. When I put some values in the form (eg. 2 and 9) the output in the console is endless 1111111111111111
  and then the error: Uncaught RangeError: Maximum call stack size exceeded.</p>
  
  <p>Please advise</p>