JSFiddle - React, Tailwind, and code Playground

by Nirav Mehta

HTML

<p></p>

JavaScript

function liveClock() {
		    	var today = new Date();
			    var h = today.getHours();
    			var m = today.getMinutes();
	    		var s = today.getSeconds();
		    	m = checkTime(m);
    			s = checkTime(s);
	    	
		    	$("p").html(h + ":" + m + ":" + s);
			    var t = setTimeout(function () { liveClock() }, 500);
    		}
    		function checkTime(i) {
	    		if (i < 10) { i = "0" + i };  // add zero in front of numbers < 10
		    	return i;
    		}

liveClock();