google script (JS) - maximum recursion depth
google-apps-script, javascript, recursion
Solution
It is 1000, as one can see from here:
function recurse(i) {
var i = i || 1;
try {
recurse(i+1);
} catch (e) {
Logger.log(i);
}
}
Problem
What is the maximum recursion depth in Google Apps Script scripts? I have a function, `match_recurse`, which looks like the following pseudocode: ``` function match_recurse(array) { for (i=0, i<3, i++) { var arr2 = array.copy().push(i); if (is_done(arr2)) break; match_recurse(arr2); } } ``` (It also returns its results, but I don't want to bloat the question.) Now, because the execution errored, the execution transcript and the logs were not saved, so I have no way of knowing whether my `is_done` function is doing its job wrong. I can do a few cases of the problem on paper and check recursion depth, but I don't know what the maximum is supposed to be. Looking on the web, I saw an article mentioning that IE has a max call stack of 13 if you go through the Window object, but nothing else.