console.time()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

console.time() メソッドは、長い処理がどれくらいかかるかを計測することができるタイマーを起動します。それぞれのタイマーに固有の名前を付けると、そのページに 10,000 個までのタイマーを実行させることができます。同じ名前を引数として console.timeEnd() を呼び出すと、タイマー開始からの経過時間がミリ秒単位で出力されます。

詳細や使用例については、 console のページのタイマーを参照して下さい。

メモ: この機能はウェブワーカー内で利用可能です。

構文

js
time(label);

引数

label

新しいタイマーにつける名前です。それぞれのタイマーの識別に用います。同じ名前を使用して console.timeEnd() を呼び出すと、タイマーを終了して時間をコンソールに出力します。

返値

なし (undefined)。

仕様書

Specification
Console
# time

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
time() static method

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報