+ 1

Why is the fps & interval NaN?[SOLVED]

Everything seems fine but the fps is NaN and so is the interval. Why is this happening? https://code.sololearn.com/WwweLFkgnbOG/?ref=app

26th Dec 2021, 10:39 AM
Bhaveshsingh Pawar
Bhaveshsingh Pawar - avatar
2 Respostas
+ 6
Change line 31: interval = (Date.now()-t)/1000; NaN usually arises when some math operation fails. In this case, you passer the Date.now method into a subtraction operation with t which does not work.
26th Dec 2021, 10:56 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
👑 Prometheus 🇸🇬 thank you, I was missing () after the Date.now method. Now it works fine.
26th Dec 2021, 12:08 PM
Bhaveshsingh Pawar
Bhaveshsingh Pawar - avatar
Quente hoje
.
1 Votes
What?
0 Votes
HTML
0 Votes
Web
0 Votes
Quiz duel
0 Votes
FRC Coding?
1 Votes
AI
2 Votes
help
0 Votes
APIs
1 Votes