console.time and console.timeEnd

1 min. read Published: Updated at:

I just read about these two functions that can be used to measure times without the need of using the Date class. And I use stuff like console.log('End: ' + (new Date.now() - start))

Example:

// Start the timer
console.time('testStuff');

// Do your stuff here

// Stop the timer
console.timeEnd('testStuff');

// Console outputs something like 648.124ms

Webmentions

0 Mentions
0 Reposts
Likes