📜  经过时间 function() {math javascript 代码示例

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

代码示例2
function calculate() {
    let start = Date.now();

    for (let count = 0; count < 100000; count++) {
        dice = Math.ceil(Math.random() * 6);
    }

    let elapsed = Date.now() - start;

    document.getElementById("lesstime").innerHTML = "The elapsed time was " + elapsed + " milleseconds. ";
}