JavaScript Console not starting loop. No apparent bugs can be found

℡╲_俬逩灬. 提交于 2019-12-13 09:54:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!