Can you hold value of variables across scripts?

Can you hold value of variables across scripts?

Can you use and hold the value of variables across scripts?

Say for example, onUserInput of text field Field1 I set a variable:

intHold = 1;

Then on onUserInput of text field Field 2 I do the following

if (intHold == 1) {
// do this
} else {
// DNE 1, do this
}

Will this work? If not, what's the right way to do this?