JSFiddle - React, Tailwind, and code Playground

HTML

<div id="timerText">00:00</div>

JavaScript

$(document).ready(function() {
	timerSet(9,12);
	timerRun();
});

function timerReset() {
	alert("workin");
}

function timerSet(inputMinutes, inputSeconds) {
	minutes = inputMinutes;	
	seconds = inputSeconds;	
	finalTimeInSeconds = minutes*60 + seconds; //finalTimeInSeconds is the time it takes for the timer to be 00:00 in seconds.
	timerPrint();
}

function timerAdd(inputMinutes, inputSeconds) {
	alert("workin");
}

function timerSubtract(inputMinutes, inputSeconds) {
	setInterval(function () {
		if(minutes > 0 && seconds == 0) {
			minutes--;
			seconds = 59;
		} else {
			seconds--;
		}
		timerPrint();
	}, 1000);
}

function timerRun() {
	timerSubtract();
}

function timerStop() {
	alert("workin");
}

function timerPrint() {
	displayMinutes = (minutes.toString().length == 2) ? minutes : "0" + minutes;	//ternary operator: adds a zero to the beggining 
	displaySeconds = (seconds.toString().length == 2) ? seconds : "0" + seconds;	//of the number if it has only one caracter.
	$("#timerText").text(displayMinutes + ":" + displaySeconds);
}

function totalTime() {
	var totalTimeInSeconds = minutes*60 + seconds;

	return totalTimeInSeconds; //totalTimeInSeconds is the time that the timer now displays in seconds.
}