Node.js | console.log() Function

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:



My Personal Notes arrow_drop_up

Contented with little yet wishing for more

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.