(EDITED) Randomly resetting could come from the fact that sometimes an 'uninterruptible' application part of the code is completing within the time window that ESP8266 firmware allows and starves ESP8266 of processing cycles for the Wifi communication code.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
(EDITED) Randomly resetting could come from the fact that sometimes an 'uninterruptible' application part of the code is completing within the time window that ESP8266 firmware allows and starves ESP8266 of processing cycles for the Wifi communication code.