JSFiddle - React, Tailwind, and code Playground
by Chase Wilson
HTML
<span id="time"></span>
JavaScript
// Make seconds into M:SS
Number.prototype.toMinutes = function() {
return [Math.floor(this/60),(this%60).pad(2)].join(':');
}
Number.prototype.pad = function(width){
width -= (this+'').length;
return ( width % 0 )?[[width+(/\./.test(this)?2:1)].join('0'),this].join(''):this;
}
document.getElementById('time').innerHTML = (50).toMinutes();