+ 2

Web code not working in code playground

Why many web codes whichnuse Javascript, even the most popular one, are not working when I run them in he app code playground? They end up with something like requestAnimationFrame is not defined Uncaught reference error: ... is not defined illegal token on line... illegal expression on line... I don't know JS to try to fix it, but I found out that the keyword 'let' is one of thing which cause the problem For example: https://code.sololearn.com/Wofj3Kh7FvXN/?ref=app https://code.sololearn.com/WqKUb6hN5A8j/?ref=app

9th Jul 2018, 12:51 PM
michal
6 Réponses
+ 3
Is it just the ES6 code that generates the error? If that is the case, I had exactly the same problem.I sent an email at info@sololearn.com and I got this as a reply:   You need to update your Android’s webview to the latest version, to support ES6 syntax. You can get it from: https://play.google.com/store/apps/details?id=com.google.android.webview Hope this helps! If that's not the case, you can send an email to info@sololearn.com describing your problem.
9th Jul 2018, 1:02 PM
giannismach
giannismach - avatar
+ 1
michal You're welcome. As you say it is the keyword let that causes the problem, then your problem is probably the one I described above.
9th Jul 2018, 3:22 PM
giannismach
giannismach - avatar
0
I'm not sure exactly what the problem is here, but I know there is often a delay in SoloLearn between loading the HTML and running the JS. Try surrounding the entire JS code with this... window.onload = function(){ //put the code here };
9th Jul 2018, 1:00 PM
James
James - avatar
0
James I got uncaught typeerror: onload property of object [object global] is not a function
9th Jul 2018, 3:19 PM
michal
0
Lucky Luke Thanks. It seems to be because of ES6 (but i don't know much about it so i'm not sure).
9th Jul 2018, 3:21 PM
michal
0
Oops. I fixed it. But I don't think it will fix the problem in this case.
9th Jul 2018, 3:23 PM
James
James - avatar