Why is the fps & interval NaN?[SOLVED] | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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