Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 javascript 记录事件之间的时间。
所以,我将间隔设置为 10
gameTimer = setInterval(incTime,10);
最后,例如,如果我得到 99 如何将其转换为浮点变量 (0.099) ?
您可以简单地将其除以 1000。如下所示:-
var a = 99; var b = 99/1000.0; var result = b.toFixed(3); //Use this if you want to restrict the number after the decimal. Like 0.099