Functions run without being called

Link to the project or level:

What I expect to happen:
The functions should run only when I click the appropriate buttons.

What actually happens:
The functions run without being called. The function triggers as soon as the code reads the onEvent block, even if the event has not been triggered yet.

What I’ve tried:
Restarting the browser, restarting the computer, remaking the functions, switching from block to text view.

The function is, in fact, being called by your code - it is working as designed!

Given that this is crunch-time for the create task, I cannot provide granular support via the forum because I don’t want to invalidate anyone’s project work. I can, however, promise that the function is being called by your code - it is working as designed! I would encourage you to try to pinpoint the error by doing some debugging:

  • What line is causing this behavior? Can you remove/comment outlines to remove the error?
  • How is this project similar to others you have written? Can you use any of them as a template?

If you are still running in to issues after the 20th, I would be happy to talk more specifically about the issues in this project.

Hi, the problem isn’t that the functions are not running, it is that they are running prematurely.

I define the functions, then I put them in the callback of the onEvent blocks. However, instead of waiting for me to click the associated button, the function just runs by itself.

The only warning I get is as follows:
WARNING: Line: 14: onEvent() callback parameter value (undefined) is not a function.WARNING: Line: 15: onEvent() callback parameter value (undefined) is not a function.


The code is running correctly as you have written it. Looking at the code I would expect the functionality you are describing. I suggest trying the two debugging tips I mentioned in the post above.