Skip to main content
2 of 2
Commonmark migration

Javascript

<script>
    var button = document.createElement('button');
    button.addEventListener('click', document.createElement);
    window.onerror = setTimeout.bind(window, button.click);
    button.click();
</script>

Explanation: document.createElement() expects a parameter, so clicking the button causes an error to be thrown. The window catches the error and dispatches another click to the button. I don't think this meets the definition of recursion provided since the browser's event loop is invoking the error handler.

aebabis
  • 443
  • 5
  • 11