<html>
<body>
<h1>JavaScript console.time() Method</h1>
<p>Press F12 on your keyboard to view the result in the console view.</p>
<script>
var i;
console.time("test for loop");
for (i = 0; i < 1000000; i++) {
// some code
}
console.timeEnd("test for loop");
i = 0;
console.time("test while loop");
while (i < 1000000) {
i++
}
console.timeEnd("test while loop");
</script>
<p>Test to see which loop is the fastest.</p>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_console_time3 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:01:39 GMT -->
</html>