📄 elapsed-time.js
字号:
// create a new Date object then get the current time
var start = new Date();
var msec1 = start.getTime();
// run a loop counting up to 250,000
var num = 0;
for( var i = 0; i < 250000; i++ )
{
num++;
}
// get another Date object and get the time now
var stop = new Date();
var msec2 = stop.getTime();
// subtract the start time from the stop time to
// discover the amount of time between the two points
var diff = ( msec2 - msec1 ) / 1000;
// display the elapsed time
alert("Time elapsed: " +diff+ " seconds");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -