setInterval id

Hi,

is there anyway to pass the setInterval id number into the function you are wanting to run.

I want the function i run to run clearInterval when a certain test suceeds.

cheers very much