Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

console.timeEnd() — ending a timer

console.timeEnd() ends a timer started by console.time() and prints its elapsed time with its label.

Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support

Syntax

console.timeEnd()
console.timeEnd(label)

console.timeEnd(label) removes the timer started by console.time(label) and prints elapsed time. It returns undefined, not a number.

Labels must match exactly; the default is "default". console.timeLog(label) prints elapsed time without ending the timer. An ended label can be reused. Avoid ending nonexistent timers: if the label has no active timer, the method returns without printing an elapsed time. The standard allows a warning in this case but does not require one.

Duration formatting is implementation-defined. This API belongs to the Console Standard, not a particular ECMAScript edition; having Node 24 does not establish browser support.

Examples

(() => {
  console.time("sum-demo");
  let sum = 0;
  for (let i = 1; i <= 100; i++) sum += i;
  console.timeEnd("sum-demo");
  console.log(sum);
})();

Result

sum-demo: <duration>
5050

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources