Rahul
Rahul

Reputation: 2597

What is output of console.timeEnd()

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

Upvotes: 0

Views: 158

Answers (1)

Engincan Veske
Engincan Veske

Reputation: 1585

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();

Upvotes: 2

Related Questions