Browser console and calculating multiple javascript execution time differences

前端 未结 2 999
北荒
北荒 2021-01-26 15:21

I can easily do this:

console.time(\'mytimer\');
doSomeWork();
console.timeEnd(\'mytimer\');

But is it possible to calculate time in multiple f

2条回答
  •  无人及你
    2021-01-26 16:23

    There is a solution which is a living standard. Seems like its already on chrome and major browsers and nodejs

    https://developer.mozilla.org/en-US/docs/Web/API/Console/timeLog

    console.time("answer time");
    alert("Click to continue");
    console.timeLog("answer time");
    alert("Do a bunch of other stuff...");
    console.timeEnd("answer time");
    The
    

提交回复
热议问题