DEV Community

Discussion on: 8 JavaScript Tips & Tricks That No One Teaches 🚀

Collapse
 
geminii profile image
Jimmy

Really nice tips.
Question : what is the best option between using performance.now() and console.time() 🤔

Collapse
 
garvitmotwani profile image
Garvit Motwani

I usually use performance.now() so I would recommend that but console.time() is also good!!

Collapse
 
sebring profile image
J. G. Sebring

console.time will be limited to output in console, hence it is more suitable for temporary debugging/test situations.

Any other cases I'd use performance.now, like displaying time in html, sending to backend etc.

Collapse
 
geminii profile image
Jimmy

Good to know thanks for this tip 😀👍

Some comments have been hidden by the post's author - find out more