function incrementStopwatch(stopwatch) {
  let time, minutes, seconds;
  time = stopwatch.getAttribute('datetime');
  // The datetime attribute holds a duration string here with the value
  // PT##M##S where ## is always a 2 digit value of the minutes / seconds
  minutes = parseInt(time.substr(2,2));
  seconds = parseInt(time.substr(5,2));
  
  // If the seconds isn't at its max yet, increment it
  if (seconds < 59) {
    seconds += 1;
  // If the seconds is at 59, increment minutes and reset seconds
  } else {
    seconds = 0;
    // If minutes hits 99, reset them to zero. Otherwise, increment them
    if (minutes == 99) {
      minutes = 0;
    } else {
      minutes += 1;
    }
  }

  // Convert the number value of minutes & seconds to strings of length 2 (prepended with zeros if applicable)
  minutes = minutes.toLocaleString('en-US', {minimumIntegerDigits: 2, useGrouping: false});
  seconds = seconds.toLocaleString('en-US', {minimumIntegerDigits: 2, useGrouping: false});
  // Update the datetime attribute and the stopwatch text with the new time
  stopwatch.setAttribute('datetime', `PT${minutes}M${seconds}S`);
  stopwatch.innerHTML = `${minutes}:${seconds}`;
}
/**
 * Increments the given stopwatch element by one second
 * @param {Element} stopwatch The stopwatch element one would like to increment
 */
Increments the given stopwatch element by one second
@param {Element} stopwatch The stopwatch element one would like to increment
Increments the given stopwatch element by one second @param { Element } stopwatch The stopwatch element one would like to increment
function incrementStopwatch(stopwatch) {
  let time, minutes, seconds;
  time = stopwatch.getAttribute('datetime');
  minutes = parseInt(time.substr(2,2));
  seconds = parseInt(time.substr(5,2));
  if (seconds < 59) {
    seconds += 1;
  } else {
    seconds = 0;
    if (minutes == 99) {
      minutes = 0;
    } else {
      minutes += 1;
    }
  }
  minutes = minutes.toLocaleString('en-US', {minimumIntegerDigits: 2, useGrouping: false});
  seconds = seconds.toLocaleString('en-US', {minimumIntegerDigits: 2, useGrouping: false});
  stopwatch.setAttribute('datetime', `PT${minutes}M${seconds}S`);
  stopwatch.innerHTML = `${minutes}:${seconds}`;
}
function incrementStopwatch ( stopwatch ) { let time , minutes , seconds ; time = stopwatch . getAttribute ( 'datetime' ) ; minutes = parseInt ( time . substr ( 2 , 2 ) ) ; seconds = parseInt ( time . substr ( 5 , 2 ) ) ; if ( seconds < 59 ) { seconds += 1 ; } else { seconds = 0 ; if ( minutes == 99 ) { minutes = 0 ; } else { minutes += 1 ; } } minutes = minutes . toLocaleString ( 'en-US' , { minimumIntegerDigits : 2 , useGrouping : false } ) ; seconds = seconds . toLocaleString ( 'en-US' , { minimumIntegerDigits : 2 , useGrouping : false } ) ; stopwatch . setAttribute ( 'datetime' , ` ${ minutes } ${ seconds } ` ) ; stopwatch . innerHTML = ` ${ minutes } ${ seconds } ` ; }
Increments the given stopwatch element by one second
 @param {Element} stopwatch The stopwatch element one would like to increment
Increments the given stopwatch element by one second @param { Element } stopwatch The stopwatch element one would like to increment
// The datetime attribute holds a duration string here with the value // PT##M##S where ## is always a 2 digit value of the minutes / seconds // If the seconds isn't at its max yet, increment it // If the seconds is at 59, increment minutes and reset seconds // If minutes hits 99, reset them to zero. Otherwise, increment them // Convert the number value of minutes & seconds to strings of length 2 (prepended with zeros if applicable) // Update the datetime attribute and the stopwatch text with the new time