问题
I am trying to write some which starts from 86400 and counts down all to way to 0. But when I create the loop, the console would not display anything.
Any help would be greatly appreciated!
let date = new Date();
let hour = date.getHours();
let min = date.getMinutes();
let sec = date.getSeconds();
let hourToSec = parseInt(hour) * 3600;
let minToSec = parseInt(min) * 60;
let currentSec = hourToSec * minToSec * sec;
let remTime = 86400 - currentSec;
while (remTime > -1) {
console.log(remTime);
remTime = remTime - 1;
}
来源:https://stackoverflow.com/questions/58966851/javascript-console-not-starting-loop-no-apparent-bugs-can-be-found