Is there any way to get current time in nanoseconds using JavaScript?

Achieve microsecond accuracy in most browsers using:

window.performance.now()

See also:

  • https://developer.mozilla.org/en-US/docs/Web/API/Performance.now()
  • http://www.w3.org/TR/hr-time/
  • https://caniuse.com/high-resolution-time

Leave a Comment

tech