Home > Software design >  What is output of console.timeEnd()
What is output of console.timeEnd()

Time:12-06

Code

console.time();
// ---
console.timeEnd();

// output
default: 72.081ms

Here, what is ms? is it microseconds or milliseconds?

I didn't get anything from here https://developer.mozilla.org/en-US/docs/Web/API/console/timeEnd

CodePudding user response:

ms means milliseconds.

console.time() -> starts a timer

console.timeEnd() -> ends a timer.

  • By using them together you can measure how long does it take to perform an operation.

E.g.

console.time();
for (i = 0; i < 100000; i  ) {
  // long time process
}
console.timeEnd();
  • Related