JSFiddle - React, Tailwind, and code Playground

by baacke

HTML

<div id="time"></div>

JavaScript

var secondsInMinute = 60,
    testTime = 55,
    questions = 40,
    secondsPerQuestion = (testTime / questions) * secondsInMinute,
    timeLeft = testTime * secondsInMinute;

setInterval(function(){
    document.getElementById('time').innerHTML = timeLeft;
    timeLeft--;
}, 1000);