Better way of getting time in milliseconds in javascript?

前端 未结 5 1098
说谎
说谎 2021-01-30 05:06

Is there an alternative in JavaScript of getting time in milliseconds using the date object, or at least a way to reuse that object, without having to instantiate a new object e

5条回答
  •  盖世英雄少女心
    2021-01-30 05:17

    This is a very old question - but still for reference if others are looking at it - requestAnimationFrame() is the right way to handle animation in modern browsers:

    UPDATE: The mozilla link shows how to do this - I didn't feel like repeating the text behind the link ;)

提交回复
热议问题