Calculate the performance of a function

If you want to check how long a function runs you can use this approach in your program.

const start = performance.now();
const end = performance.now();
const total = start - end
console.log("function takes" + total + "mileseconds");

Leave a comment

Your email address will not be published. Required fields are marked *