Skip to content
Related Articles

Related Articles

Node.js console.log() Function

View Discussion
Improve Article
Save Article
  • Last Updated : 14 Oct, 2021

The console.log() function from console class of Node.js is used to display the messages on the console. It prints to stdout with newline.

Syntax:

console.log( [data][, ...] )

Parameter: This function contains multiple parameters which are to be printed.

Return type: The function returns the passed parameters.

Below program demonstrates the working of console.log() function:

Program 1:




function GFG(name) {
     console.log("hello " + name);
}
  
// when parameters are passed
GFG("Geeksforgeeks");


Output:

Program 2:




function GFG(name) {
     console.log("hello " + name);
}
  
// No parameters are passed
GFG();


Output:

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!