JS Built-ins
performancebeginner

performance β€” now() returns a number

πŸ“– Usage Example
const t0 = performance.now()
doWork()
const t1 = performance.now()
console.log(t1 - t0, 'ms')

performance.now() returns a high-resolution timestamp to measure elapsed time.

performance.now()

performance.now() returns a high-resolution timestamp in milliseconds as a number.

Challenge: Verify that typeof performance.now() is 'number'.

πŸ’‘ Hints (1)
  • β€’ performance.now() returns DOMHighResTimeStamp β€” a floating-point number