I am super new to learning Javascript so please ELI5! ^_^
I made a script that I am extremely proud of, since I am a beginner. It uses an array. Right now, the entire script is within one script call in the editor, and it works great.
What I'd like to do is put the arrays that are already inside the script, to a central location, in order to access it from more than one event. Doing this will allow me to make edits to the array in one place instead of two (or three, or four, depending).
I tried to make it a plugin but that didn't work.
The script didn't see the array ("counterCoords" is not defined).
Is there anywhere else I can put it?
Thanks for the help!!
I made a script that I am extremely proud of, since I am a beginner. It uses an array. Right now, the entire script is within one script call in the editor, and it works great.
What I'd like to do is put the arrays that are already inside the script, to a central location, in order to access it from more than one event. Doing this will allow me to make edits to the array in one place instead of two (or three, or four, depending).
I tried to make it a plugin but that didn't work.
JavaScript:
(() => {
// setting coords to counter number
const counterCoords = [
{counter:1, coords:[8,6]},
{counter:2, coords:[9,6]},
{counter:3, coords:[10,6]}
];
})();
The script didn't see the array ("counterCoords" is not defined).
Is there anywhere else I can put it?
Thanks for the help!!