it
starts a timer, and it is used to compute the duration of an operation.
HelloWorld.js
/* Start the timer */ console.time('100000-elements'); for (let i = 0; i < 100000; i++) { } /* End the timer */ console.timeEnd('100000-elements');
Output
100000-elements:
3.242ms
Points to note
a. Elapsed time is
printed in milliseconds.
b. Timers are identified
by unique label. In our example, '100000-elements' is the label.
No comments:
Post a Comment