Javascript in AppLab?

code.org uses Javascript, right? My students were really confused about loops after Unit 3/Lesson 9. (Makes sense - after all, loops take a while and it was only the one lesson.) So, I’ve been supplementing the code.org material with a number of extra labs. Anyway, looking around for additional resources for them, I considered some of the Code Avengers Javascript lessons. However, when I type alert(“some string”); or println(“some string”); or window.alert(“string”); into AppLab none of these are known. Hmm…I do not know Javascript and just make it up from the Java and Python that I do know, but it seems maybe that the AppLab environment is super constrained in the subset of Javascript that can be interpreted and I better not stray lest I cause more confusion for the students? Thank you for any help.

Code.org uses a limited version of javascript. For example, the operator “const” cannot be used even though the syntax highlighter acknowledges it. However when you run the code, it doesn’t work. I believe code.org has its on compiler and that’s one of the reasons it runs so slow when there is too much being evaluated.

The reason some of the variables are blocked is because that would allow the app to do other stuff than is intended. Otherwise you can change document.location and redirect to a malware site.

THAT
I just looked up ES6 and I think this is what code.org is missing.

1 Like

Hi @skenner,

From what I understand, @infinitestasis is correct.

To provide some more context, App Lab’s primary purpose is a learning tool to support the Computer Science Principles curriculum. Its capabilities definitely go beyond that, but some of the limitations are under that lens (and I’m sure, as mentioned by @infinitestasis, some limitations are for security).

Thus we understand (and forewarn :stuck_out_tongue:) that using functions/commands that aren’t in the App Lab toolbox may not be supported.

I’m wondering if there’s some substitute commands we can use for what you’re trying to do. println sounds very much like console.log. Not sure about the alerts though, as I don’t think App Lab supports popping up a new window. The closest might be to just display a label on the screen, or switch to a new screen with the message and an “ok” button.

Frank

1 Like