js0001 发表于 2018-12-09 | 阅读次数: 字数统计: 72 | 阅读时长 ≈ 1 1234567891011121314151617181920<!DOCTYPE html><html><head> <title>A simple performance counter</title> <script> maxCount = 10000; console.time("My operation"); for (var n = 0; n < maxCount; n++) { /*perform the operation to be measured*/ //#B } console.timeEnd("My operation"); </script></head><body> Outputs to the console (press F12)</body></html>