0
Why isnt ES6 code working on the codeplayground?
Its giving me "unexpected identifier", even for code, given by the lessons itself.
13 odpowiedzi
+ 1
Found a solution on here
https://www.sololearn.com/Discuss/1220172/?ref=app
+ 4
Codeplayground does support ES6. Kindly share the link of the lesson where you're getting that error.
+ 3
K4run0 if you'd have gone thoroughly through the topic called var&let in here https://www.sololearn.com/learn/JavaScript/2969/ then you'd have seen that it's clearly mentioned there that
"let allows you to declare variables that are limited in scope to the block, statement, or expression in which they are used.
In this case, the name variable is accessible only in the scope of the if statement because it was declared as let."
+ 2
Is the sololearn app using androids built in browser enginge? Than maybe my phone is too old?or can i update it in some way?
+ 2
TheWhiteCat💡 Yes, your code should alert 'jack', but if i'm running it, i still get the "unexpected identifier" error on line 4 (let)
Btw: running the newest version of the app on an android 4.4.2.
+ 2
It's strange,
because when I run the code it alerts the expected. I don't find any errors in the code.
+ 2
Ok, hope you can find a solution for this problem 😉
+ 1
K4run0 , it's normal, because name variable declared with "let" exists only in the if conditional check. You can see the code.
https://code.sololearn.com/W7yWus25NzYx/?ref=app
+ 1
K4run0, the code I proposed doesn't give errors, it just alerts the value of name variable => 'Jack'.
0
It happens here for example
https://code.sololearn.com/WtK6Ek8Bcsge/?ref=app
Getting an error on "let" like evertime its used (or other ES6 stuff)
0
Thanks, i understand what you r telling me, but i still get the error.
The Code given by thewhitecat gives me the error in line 4 ( again the "let")...
0
TheWhiteCat💡 i know, the code is fine. It's just auf Problem for me to run ES6 code on the playground. I suspect that the app uses the android-built-in browser enginge and it's too old for ES6, so m question is, if it's like that and if so, can i do something about it? (Except from customROM stuff or buying a new phone😉)
0
Thx