Accessing global variables inside components online

So I have a welcome screen routine at the beginning of my experiment, which has a code component initializing all variables I’m using for the experiment. In other routines, I modify these variables according to the current task. These work fine offline, however when I’m online I get errors or issues stating that those variables are undefined. I tried to refer to these variables using .this but it doesn’t help. What can I do?

For example, I had a function to create semi-random trials for my liking and suitable for my experiment design. The function was defined at this same code component, however when I went online it wasnt recognized by JS, so I had to move the function to the same scope where I used it. Referring to it using .this didn’t help.

If you define a function abc(x) you need to write abc=function (x) {}

Take a look at my crib sheet for more details

Thanks, that fixed it. However I have an integer variable which I use to track some stuff, when I reset this after using it in a routine, it doesn’t change. Why could that be?

Nevermind, I found a way to solve this.

I was going to say (which may be useful for future questions) please start by posting exactly what you’ve tried so far. Sometimes the issue is spelling mistakes, or other typos.