I have a global variable
var trigger = 0;
In addition I have some functions which once completed,they increase the value of this variable.
My goal is to trigger an additional function once the variable trigger has reached the value 2.
Which is the best way to achieve this ?