Code Editor Project

Hey everyone! As part of the Berkeley Summer Computer Science Academy, I started working a little bit with snap! I've made a simple little code editor project, based on the "Code Editor" project by joecooldoo:

To view the output of your code, you need to access the developer tools on your own machine, then navigate to the console tab, which will show you the output.

Currently, there is an issue with the braces causing an error (used in for loops, if statements, etc.), which is obviously not intended. I'm currently working to fix this issue.

Please try my first project and le t me know if there is anything that needs to be fixed, or if you have suggestions on something I should add! Thanks!

Hi, welcome to Snap!! I hope you're enjoying the Academy.

Personally, though, I'm not running a project that calls Javascript eval() on some variable containing who knows what! This is a perfect example of why you have to enable Javascript explicitly every time you load a project that uses it. (I mean, I can find out what's in the variable by reading the code, of course, and probably it's whatever code I type into your editor. But who knows what some hidden script might put in there.)

Would it be a good idea to just make the code slot in the javascript function block static? There's no reason anyone should be able to drop a reporter into it.

I think the point of the project is that the user types in JS code, and the program runs it.

I know the point of the project. I was really just thinking of the fact that it's generally discouraged to put blocks inside the code input in a javascript block, due to the fact that js code could be messed up, kind of like this

It would make more sense to just not allow users to put blocks in the code slot, so they'd have to do it the (much better) proper way.

This isn't really about this project, I kind of hijacked the topic with an idea that just popped into my head, sorry.

Oh but people are always wanting to put, e.g., a project name in a variable and then use "(var).xml" in a script.