JavaScript秒针转换00:00:00代码

var str = realFormatSecond(e.target.currentTime);

console.log(e.target.scrollTop); //1255256252

console.log( str ); // 05:31

function realFormatSecond(second) {

var secondType = typeof second;

if (secondType === "number" || secondType === "string") {

second = parseInt(second);

var mimute = Math.floor(second / 60);

second = second - mimute * 60;

return ("0" + mimute).slice(-2) + ":" + ("0" + second).slice(-2);

} else {

return "00:00";

}

}