0
JS how to use the new Date() as setInterval()?
Not exactly sure if itâs new Date(), but I know itâs something like that ... new Date(), or setDate(). Iâve seen people recommending using the new Date, (or set date if thatâs the right one) instead of setInterval(). They say setInterval and interval arenât stable... So how would I use the date object to set Interval, still using milliseconds?
5 Respostas
+ 6
//Here is sololearn course on date object but i am not sure what you are concerned about setInterval()
https://www.sololearn.com/learn/JavaScript/1244/
+ 4
Ginfio Oh you wanted to find intervals between 2 times ,
+ 3
Ginfio There is no function like setDate() and new date does not do work you mentioned , maybe it's is setTimeout() and can you please explain your problems more clearly
+ 2
https://code.sololearn.com/WucfuigE2Z58/?ref=app
Sudarshan Rai đ , Iâm not comcerned about it.
What i was thinking was like...
In this code, I saw that with the setInterval() method, it wasnât counting 1000 milsec in 1 second.
The milliseconds are way behind than where they should be at.
So, i mentioned that problem one time and someone mentioned to me about using setDate() instead of interval.
.
+ 1
Sudarshan Rai đ ahh, now i know what it is.
If you would, look at the first answer on this thread (stackoverflow), that was what i was thinking about.
itâs new Date() btw.
https://stackoverflow.com/questions/1360818/how-to-measure-the-milliseconds-between-mousedown-and-mouseup