+ 2

Sololearn web code time limit?

The following js code contains an infinite loop. So it should never be able to execute the alert function called after the loop. However when executing the code on the sololearn website in a desktop web browser it does call the alert function. So I wondered if sololearn has some kind of time limit on the web codes too. Until now I thought the js code is just executed in the browser. Does anyone know how sololearn controls the specific execution of the js code and what exactly those time limits for web codes are? https://code.sololearn.com/W2MQ31jfOXed/?ref=app

24th Jun 2021, 9:12 AM
Hape
Hape - avatar
4 Respostas
+ 1
**** Website Only with console displayed **** There is a 3 second time limit on for loops and while loops when code is written in the js panel https://code.sololearn.com/W0A11a6a20a4 but if an infinite loop is written in the HTML panel there is no time limit. https://code.sololearn.com/W905a249A00A 🤷‍♂️
24th Jun 2021, 1:39 PM
ODLNT
ODLNT - avatar
+ 1
ODLNT Thanks. That is very interesting. Do you have an idea why they do this only on their website in the js section?
24th Jun 2021, 2:12 PM
Hape
Hape - avatar
0
Hape I'm not sure why this is the case, maybe it has something to do with them wrapping the code in an IIFE? And you are welcome.
24th Jun 2021, 2:41 PM
ODLNT
ODLNT - avatar
0
ODLNT that would not really explain why they only do this for the website version. I guess it would have been easier for them to just use the same execution environment for all platforms as far as that is possible. Since what they are doing requires them to additionally insert js code into the user generated one this seems to me like something which really needed to be done. However maybe I just do not know enough about the exact technical details of this cross platform web code execution environment to judge what this might be needed for.
24th Jun 2021, 2:59 PM
Hape
Hape - avatar