意外标识符每日奖励功能

unexpected identifier daily reward function

本文关键字:功能 每日 标识符 意外      更新时间:2023-09-26

在我的函数中收到意外的标识符错误。

JavaScript

if (dailyRewardActive)                      //used to show how much time till it ends
{
    minutes = (((900000 - timer) / 60)/1000 - ((((900000 - timer)) % 60)/1000)
    seconds = ((900000 - timer) % 60000)   //getting it here
    document.getElementById("timer").innerHTML = minutes.toFixed(0)+":"+seconds.toFixed(0);
    timer = timer + 1000*timeBetweenTicks;
}

.html

Time left on Daily Reward: <span id = "timer">0</span>

计时器是一个全局变量(我知道这是不好的做法,但此时很难在此代码中更改)

上面一行的括号不匹配(不足为奇,很难看!如果将它们隔开并匹配,则可以找到缺少的:

minutes = (
    (
        (900000 - timer) / 60
    ) /1000 - 
    (
        (
            ((900000 - timer)) % 60
        ) /1000
    )
//there's supposed to be another )
) //there we go