Im using a function to start a count up timer using moment.js library , how could I make a stop timer function?
function startTimer()
{
var startTimestamp = moment().startOf("day");
setInterval(function() {
startTimestamp.add(1, 'second');
document.getElementById('timer').innerHTML =
startTimestamp.format('HH:mm:ss'); }, 1000);
}
startTimer();
<div id="timer"></div>
Thanks in advance