我正在尝试测试嵌入到html中的脚本需要多长时间以及执行外部javascript需要多长时间。
我在尝试:
更新:
<!DOCTYPE html>
<html>
<body>
<h1>External JavaScript</h1>
<p id="demo">A Paragraph.</p>
<button type="button" onclick="myFunction()">Try it</button>
<p>(myFunction is stored in an external file called "myScript.js")</p>
<script src="myScript.js"></script>
<script>
var t0 = performance.now();
myFunction();
var t1 = performance.now();
console.log("Call to doSomething took " + (t1 - t0) + " milliseconds.")
</script>
</body>
</html>
没有输出时间。