Stop timer

I´am trying to make a timer to my hangman game, and this is the code I´have.


    [FONT=&quot]timer = 0;[/FONT]
  
  [FONT=&quot]countup = function(){[/FONT]
  [FONT=&quot]     timer++;[/FONT]
  [FONT=&quot]}[/FONT]
  
  [FONT=&quot]countupInterval = setInterval(countup,1000);[/FONT]
  

If i would like the timer to stop on a specific frame and show the time result how do I do that?
With some kind of if-else statement, or some kind of function.stop.
I´am totaly new to this.
Please help!