Private
#elapsedPrivate
#startPrivate
#stopGets the elapsed time in milliseconds. If the timer is running, returns the currently elapsed time; otherwise, returns the time elapsed between the start and stop points.
The elapsed time in milliseconds.
Returns a string representation of the elapsed time.
Optional
format: "ms" | "seconds" | "minutes"The time format to use for the output. - 'ms': milliseconds (default) - 'seconds': seconds with one decimal place - 'minutes': minutes in MM:SS format
A formatted string representing the elapsed time.
Utility class for measuring and tracking elapsed time.
The Timer class provides functionality to measure elapsed time with millisecond precision. It can be started, stopped, and reset, and supports different formatting options when converting to a string representation.
Example
The Timer instance can be used directly in string contexts or arithmetic operations through its implementation of Symbol.toPrimitive.