I've got the following function:
function getRange() {
// generate a range of values from value up to climit
// excluding climit
var countup = function(value, climit) {
if (value < 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);
}
}
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.
Please advise