📜  在 javascript 代码示例中获取执行时间

📅  最后修改于: 2022-03-11 15:04:04.894000             🧑  作者: Mango

代码示例4
const { JSDOM } = require("jsdom");
const { window } = new JSDOM();
 
var start = window.performance.now();
 
// task starts
for (var i = 0; i < 100000000;i++);
// task ends
 
var end = window.performance.now();
console.log(`Execution time: ${end - start} ms`);