function foo() { // do stuff } const start = performance.now(); foo(); const end = performance.now(); console.log(`Call to ${foo.name} took ${end - start} ms.`);
Call to foo took x ms