console.time(timerName);
启动一个计时器(timer)来跟踪某一个操作的占用时长。
每一个计时器必须拥有唯一的名字,页面中最多能同时运行10,000个计时器。
当以此计时器名字为参数调用 console.timeEnd() 时,浏览器将以毫秒为单位,输出对应计时器所经过的时间.
console.time('test');
function disp_confirm()
{
var r=confirm("Press a button")
if (r==true)
{
document.write("You pressed OK!")
}
else
{
document.write("You pressed Cancel!")
}
}
// 停止计时,输出时间
console.timeEnd('test');
https://developer.mozilla.org/zh-CN/docs/Web/API/Console
Console