1var t0 = performance.now();
2
3doSomething(); // <---- The function you're measuring time for
4
5var t1 = performance.now();
6console.log("Call to doSomething took " + (t1 - t0) + " milliseconds.");
1const { JSDOM } = require("jsdom");
2const { window } = new JSDOM();
3
4var start = window.performance.now();
5
6// task starts
7for (var i = 0; i < 100000000;i++);
8// task ends
9
10var end = window.performance.now();
11console.log(`Execution time: ${end - start} ms`);