Where can i effectively define a variable because it seems no matter where i put
var a = 0;
console.log(a)
it shows undefined.
Currently modifying a plugin and i need a new variable.
That is exactly the problem - it depends on where you put which command.
And that is not the same answer everywhere, because in some positions it becomes a global definition, in others an instance definition and in still other positions it won't work at all.
Please give a link to the website of the plugin you want to modify and tell us where you want to modify it, then we can help
Sorry for the late answer i was in vacation.
I managed it eventually. I was supposed to put the variable above ALL the code and not in a function that i would call, and also remove it from
function(variable) to just function().