+ 1
console.time doesn't work on web codes
I was running a code in web that computes execution time of a task.But it doesn't work: https://code.sololearn.com/WaJUgq9ziDSQ/?ref=app But the same code work in node.js : https://code.sololearn.com/cgV5LESa3gtC/?ref=app Why?
8 Respuestas
+ 4
console object is emulated in sololearn web project (both in app and at web), so do not implement all console methods (all the more that console object is highly coupled with browser, and do not ever implement all sames methods or with same behavior) ^^
don't know how it is handled in nodejs project ;P
+ 2
visph node js uses V8 engine. So possibly it will include almost everything. Thanks for answering
0
nodejs is different from browser environment, so console is also at least quite different: output to terminal (stdout), while console in browser output in specific window frame, even if core engine used could be same (V8 for chrome/safari browsers if I do not say wrong)
0
visph I think sololearn might be emulating node js. So it may behave unexpectedly. Try console.table
0
maybe: I'm not a nodejs user, so I cannot say if sololearn less or more emulate it, or if console methods implementation differ from one version to another, or any other case ^^
I guess maybe sololearn use nodejs but could emulate console object as for web projects ;)
0
Console.time does work on sololearn web, the problem is sololearn has put a limit on how many times a loop can iterate, hence the error message 'Error: Execution stopped as an infinite loop was detected.'
What make this strange is that loops are only limited if the script is written in the js panel. You can put you script in the html panel and it runs with no problems.
https://code.sololearn.com/W8a16a11A187
0
ODLNT still it won't. I've updated the code and it iterates 10 times. Also printed result.
https://code.sololearn.com/WaJUgq9ziDSQ/?ref=app
0
It work on inspect tools in pc