Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const timing = callback => {
- // Get the start time using performance.now()
- const start = performance.now();
- // Perform the asynchronous operation
- // Finally, log the time difference
- return Promise.resolve(callback())
- .finally(() => console.log(`Timing: ${performance.now() - start}`));
- };
Add Comment
Please, Sign In to add comment