One of the simplest ways to have a rough idea of how long a piece of code is taking to execute is by using the
console.time("answer time"); // where `answer time` is a label to identify this timer alert("Click to continue"); console.timeLog("answer time"); alert("Do a bunch of other stuff..."); console.timeEnd("answer time");
Most of the time you just want to time a whole event and don't care about intermediate steps, though. Then, you just need
That's pretty much it.
Top comments (0)