Node.js console Tutorial

Posted by

The tutorial provides the debugging mechanism provided by node.js console module and the console methods which can be used based on programming requirements.

node.js console methods

The node.js console module provides the below console methods used in the node.js stream

  • console.log ( ) – used for displaying the message / output on the console.

Example – Enter the below command and save the file as “hello.js”

console.log(‘ Hello oracleappshelp users. Happy Learning’);

Execute the file -> node hello.js

  • console.error ( ) – used for displaying the error message on the failure of the processing.

Example: below command depicts console.error message.

console.error(new Error (‘ERR1001 – The data processing is failed’));

  • console.warn ( ) – used to display the Warning / Informational message.

Example: below command depicts console.warn message.

Comments are closed.