JSFiddle - React, Tailwind, and code Playground

by BoxMan0617

HTML

<div id="timer"></div>

JavaScript

var TestTimer = {
    curr_minute: 30,
    minutes: 30,
    element: null,
    new: function(element_id) {
        this.element = $('#'+element_id);
        this.UpdateTime();
    },
    UpdateTime: function() {
        this.element.text(this.curr_minute);
        this.curr_minute--;
        if(this.curr_minute <= 0)
            this.EndTest();
        else
            //setInterval(function(){UpdateTime();}, 5000);
    },
    EndTest: function() {
        alert('Test is done!');
    }
};

TestTimer.new('timer');