About interval

i created a button and a dynamic text box with variable “a” and here are my codes for the bottom:

on(realese){
a = 5;

setInterval(countdown,1000);

function countdown(){
if(a > 0){
a–;
}
}
}

when i test it,the first time work all fine,the “a” decrease 1 every second,but the second time it just doesnt act how it suppose to be.is there something wrong with the interval?