Using a variable in two functions.

I am working on making a beta for my site, and i am making a terms and conditions page. I can’t get this script, only letting you go through to the beta page if you accept:

export function checkboxGroup1_click(event) {
 var buttonJoinable = 1
}

export function button1_click(event) {
 
 if (buttonJoinable === 1) {

    }
}

it keeps saying to define:

 buttonJoinable

Any way to fix this?

do like that:

var buttonJoinable;
export function checkboxGroup1_click(event) {
  buttonJoinable = 1
}

export function button1_click(event) {
 
 if (buttonJoinable === 1) {

    }
}