English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML DOM console.group() メソッド

 JavaScript Console オブジェクト

console.group()メソッドがコントロール台中で新しいインライングループを作成します。

これにより、コントロール台のメッセージが追加のインデントレベルで表示され、console.groupEnd()まで使用しています。

console.group()メソッドはオプションの引数をラベル

文法:

console.group(label)
console.log("Hello!");
console.group();
console.log("またHello、今度はグループ内で!");
console.group();
console.log("またHello、今度は別のグループ内で!");
テストを見て‹/›

ブラウザの互換性

すべてのブラウザで完全にサポートされるconsole.group()メソッド:

メソッド
console.group()

パラメータの値

パラメータ説明
ラベル(オプション)グループのラベル

さらに例

console.group()を4回呼び出し、以下のようにラベル

console.group("Level 1");
console.group("Level 2");
console.group("Level 3");
console.group("Level 4");
テストを見て‹/›

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");
テストを見て‹/›

 JavaScript Console オブジェクト