Better way of getting time in milliseconds in javascript?

前端 未结 5 1143
说谎
说谎 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:11

    Try Date.now().

    The skipping is most likely due to garbage collection. Typically garbage collection can be avoided by reusing variables as much as possible, but I can't say specifically what methods you can use to reduce garbage collection pauses.

提交回复
热议问题