GO-V.ORG
As seen in

console: time() static method

Console API

Console API

The **`console.time()`** static method starts a timer you can use to track how long an operation takes. You give each timer a unique name, and may have up to 10,000 timers running on a given page. When you call console.timeEnd() with the same name, the browser will output the time, in milliseconds, that elapsed since the timer was started.

See [Timers](/docs/Web/API/console#timers) in the console documentation for details and examples.

## Syntax

```js-nolint
console.time()
console.time(label)
```

### Parameters

- `label`
- : A string representing the name to give the new timer. This will identify the timer; use the same name when calling console.timeEnd() to stop the timer and get the time output to the console. If omitted, the label `"default"` is used.

### Return value

None (undefined).

## Description

Developer tools may also include the interval between `console.time()` and `console.timeEnd()` in a performance recording. This profiling behavior is separate from the console output and is not specified by the Console API. For standard timing entries accessible to JavaScript, use performance.mark() and performance.measure().

## Specifications

## Browser compatibility

## See also

- See console.timeLog() and console.timeEnd() for examples
- console.timeStamp()
- performance.mark()
- performance.measure()
- [Microsoft Edge's documentation for `console.time()`](https://learn.microsoft.com/en-us/microsoft-edge/devtools/console/api#time)
- [Node.js documentation for `console.time()`](https://nodejs.org/docs/latest/api/console.html#consoletimelabel)
- [Google Chrome's documentation for `console.time()`](https://developer.chrome.com/docs/devtools/console/api/#time)

source: MDN Web Docs mirror · page

Cite this

"console: time() static method". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/console/time_static

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·