javascript time of execution

Solutions on MaxInterview for javascript time of execution by the best coders in the world

showing results for - "javascript time of execution"
Giuseppe
17 Sep 2016
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.");
Myrtle
07 Jan 2019
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`);