Check your script for two functions that are calling on each other to form the infinity loop. You may have three or more infinity loops in your script. Use conditional statements to guard your code against the loop.
Check your script for high levels of recursive functions. A recursive function is a function that repeats back to a former part of the script. For instance, a recursive script for a game would be if you failed a level and were sent back to the first part of the level. If you don't have your recursive functions in line, you could start an infinite loop back and forth, causing the "Out of Stack Space" error. A high level in your recursive function depends on your script and what you want to do with it. Recursive functions can be a necessary part of the code, so be careful when deleting them.
Build your very own stack, so you know there are no infinity loops in the code. Open your Document Object Model and start writing the script. Keep your countervariables throughout the script so you know there is no infinity looping throughout the code.
Tips & Warnings