# How to have JavaScript reporters run as a command

Sorry to anyone if this has already been posted about. I couldn't find anything, so I'm typing this with the assumption that no one's said anything about this.

While experimenting with JavaScript, I noticed that Snap doesn't have any way to run a command, such as this:

alert('Hello world!')


as there's only a reporter block to run an anonymous function. Sure, you can call a function that runs the alert object, but you can't call it using a command block easily. Run and launch only accept command blocks in their rings, and if you try to put a call reporter to run the command, it just lags your page out.
You can's use the report block because that skips the rest of the script and ignores any loops you might have.
GOOD NEWS! I've figured out a way to contradict my own words. There is an easy way to run a JavaScript function as a command.

I'm sure there's someone that could figure out how to make this into a custom block that accepts inputs for the parameters for the function, the code, and the arguments. I've tried, but I don't think I quite understand Snap enough to get it to work.
Let me know your thoughts!

Hi. I think you are confusing the JS Function block itself, which has to be a reporter because it reports the JS code as a procedure, with the JS code you put in the block, which can indeed be a command:

Does the example make the idea clear, or should I try a more detailed explanation?

You explained it well! I'm just a bit confused because I just tested it and the run block just creates a lot of lag for me and doesn't do anything.
My browser is chrome.

Edit: just rebooted my computer and tried again and it worked.