I’m currently using the following function which is based on an example from the web, it is called every second to display the current progress through a video stream.
Is there something I could do to make this more efficient?
function secondstominutes(secs){ var s; if(secs > 60){ var min = Math.floor(secs / 60); s = min < 10 ? '0' : ''; s += min +':'; secs = secs - min * 60; } else { s = '00:'; } if(secs < 10){ s+= '0' + Math.floor(secs); } else { s += Math.floor(secs); } return s; }
1 Answer