VOOZH about

URL: https://www.geeksforgeeks.org/node-js/node-js-console-groupend-method/

⇱ Node.js console.groupEnd() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node.js console.groupEnd() Method

Last Updated : 31 Mar, 2021

The console. groupEnd() method is an inbuilt application programming interface of the console module which is used to end the started group by calling method console.group() or console.groupCollapsed(). It indicates the end of a message group.

Syntax:

console.groupEnd();

Parameters: This method doesn't accept any parameter.

Return Value: This method doesn’t return anything but ends the group on the console.

Below examples illustrate the use of console. groupEnd() method in Node.js.

Example 1: 

Run index.js file using below command:

node index.js

Console Output:

GeeksforGeeks

 1st print from the first Collapsed group
 2nd print from the first Collapsed group

GeeksforGeeks after the Ending of the group

Example 2: 

Console Output:

GeeksforGeeks 
================================

This is the starting main group

 1st group and not from any nested group

 Starting of the 1st Nested group
 Hello Geeks for Geeks from 1st Main Nested group
 Computer Science Portal(Geeks for Geeks) 
 from 1st Main Nested group


 Starting of the 2nd Main Nested group
 Hello from 2nd Main Nested group
 Hello from 2nd Main Nested group

 Now Main group will end

This the Hello from GeeksforGeeks from outside the Main Group

===================================

Reference: https://nodejs.org/api/console.html#console_console_groupend

Comment

Explore