Skip to content
Related Articles

Related Articles

Node.js | console.log() Function
  • Last Updated : 30 Aug, 2019
GeeksforGeeks - Summer Carnival Banner

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:

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :