Pergunta de entrevista da empresa GoCardless

In Javascript what can cause a script to run indefinitely and how can you mitigate this situation