Javascript console.groupCollapsed() Method

Introduction

Create a collapsed group of messages in the console:

Press F12 on your keyboard to view the message in the console view.

View in separate window

<!DOCTYPE html>
<html>
<body>
<script>

console.log("Hello world!");
console.groupCollapsed();
console.log("Hello again, this time inside a collapsed group!");

</script>/*from w w  w. j av a  2s.  c o m*/

</body>
</html>

The console.groupCollapsed() method indicates the start of a collapsed message group.

Click the expand button to open the message group.

All messages will from now on be written inside this group.

console.groupCollapsed(label);

Parameter Values

Parameter Type Description
label String Optional. A label for the group



PreviousNext

Related