function timecodeToSeconds(timecode) {
  let timeComponents = timecode.split(':');
  let seconds = 0;
  let minutes = 1;

  while (timeComponents.length > 0) {
    seconds += minutes * + timeComponents.pop();
    minutes *= 60;
  }

  return seconds;
}
Convert youtube time codes (format: HH:MM:SS or MM:SS or SS) to seconds.

@param {string} timecode   The youtube time code.