From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/console/group/index.html | 86 +++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 files/ja/web/api/console/group/index.html (limited to 'files/ja/web/api/console/group/index.html') diff --git a/files/ja/web/api/console/group/index.html b/files/ja/web/api/console/group/index.html new file mode 100644 index 0000000000..a70a1e210e --- /dev/null +++ b/files/ja/web/api/console/group/index.html @@ -0,0 +1,86 @@ +--- +title: Console.group() +slug: Web/API/console/group +tags: + - API + - DOM + - Debugging + - Method + - Web Development + - web console +translation_of: Web/API/Console/group +--- +
{{APIRef("Console API")}}
+ +

ウェブコンソールのログに、新たなインライングループを作成します。{{domxref("console.groupEnd()")}} を呼び出すまで、以降のすべての出力のレベルを 1 段階インデントします。

+ +

{{AvailableInWorkers}}

+ +

構文

+ +
console.group([label]);
+
+ +

引数

+ +
+
label
+
グループ用のラベル。任意。(Chrome 59 でテスト) console.groupEnd() は動作しません。
+
+ +

{{h3_gecko_minversion("コンソール内でのグループの使用", "9.0", "Using_groups_in_the_console")}}

+ +

ネストされたグループを使用して関連したメッセージを視覚的に結びつけることで、出力を整理する手助けができます。新しいネストのブロックを作成するには、console.group() を呼び出します。console.groupCollapsed() メソッドは類似していますが、新しいブロックが折りたたまれており、表示するには、展開ボタンをクリックする必要があります。

+ +

注記: Gecko 9 から Gecko 51 までは、groupCollapsed() メソッドは、group() と同じでした。折りたたまれたグループは、Gecko 52 から完全にサポートされます。{{bug("1088360")}} をご覧ください。

+ +

現在のグループを終了するには、console.groupEnd() を呼び出してください。例えば、以下のようなコードです:

+ +
console.log("This is the outer level");
+console.group();
+console.log("Level 2");
+console.group();
+console.log("Level 3");
+console.warn("More of level 3");
+console.groupEnd();
+console.log("Back to level 2");
+console.groupEnd();
+console.log("Back to the outer level");
+
+ +

出力は以下のようになります:

+ +

A screenshot of messages nested in the console output.

+ +

詳しくは、{{domxref("console")}} のドキュメントで コンソールでグループを使用するセクションをご覧ください。

+ +

仕様

+ + + + + + + + + + + + + + + + +
仕様書策定状況コメント
{{SpecName("Console API", "#group", "console.group()")}}{{Spec2("Console API")}}最初期の定義
+ +

ブラウザー実装状況

+ + + +

{{Compat("api.Console.group")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf