'javascript code' - functions and global variables

I want to use a variable from an event ‘javascript code’ in another but after declaring the variable in the first block I can’t find it in the second. is there any way to talk between them?!
I’m using an external event and it has functions that I need to use! but they are called 60 times per second if i use a condition as a key it doesn’t work. So it would be interesting to create custom functions in an external event and be able to call them later in another javascript wind block.


As you can see in the tip and bottom labels of the JS event, it is wrapped in an IIFE. If you are a JS dev, you should know why they cannot access each other’s variables and how to change that. If you are not a JavaScript dev, you should not use JavaScript events, as those are not the primary scripting language of GDevelop, events sheets are, and JavaScript events are only meant for advanced JavaScript users that want to access a specific API or feature that would be otherwise impossible to access with events.