特么的,题目竟然有错误,开始读题的时候还特意看了下,怎么render输入也是second的输入呢?难道是想用second函数进行数据处理?想想也有可能,就没管,最终在测试用例里面出现了“render(second(3601))” 很尴尬。已经反馈
function second(second) {
return {
day: Math.floor(second / (24 * 3600)),
hour: Math.floor(second % (24 * 3600) / 3600),
min: Math.floor(((second % (24 * 3600)) % 3600) / 60),
second: Math.floor((((second % (24 * 3600)) % 3600) % 60) % 60)
}
}
function render(data) {
let nodeList = document.getElementsByTagName("span");
// 天
if(data.day > 0){
nodeList[0].innerText = (data.day < 9 ? "0" + data.day : data.day) + "天";
}else{
nodeList[0].classList.add("hide");
}
// 小时
nodeList[1].innerText = ("0" + data.hour).slice(-2) + ":";
// 分钟
nodeList[2].innerText = ("0" + data.min).slice(-2) + ":";
// 秒钟
nodeList[3].innerText = ("0" + data.second).slice(-2);
} 
京公网安备 11010502036488号