In theory, I would like to know a way to have a recursive function that runs forever without exceeding the call stack. I am trying to implement in javascript and I keep getting the error RangeError: Maximum call stack size exceeded
My code looks like this
class mainController{
static async func1() {
console.log('Running the Function');
mainController.func1();
}
}
Now i expect to just initiate this once in a terminal and let it run forever as long as no error.
I've seen some discussion here JavaScript recursion: Maximum call stack size exceeded which suggests there must be some exit point for the loop. However i want to believe there will be particular application for such infinite loop in setting up things like a daemon process