crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

Node.js Console
Question Posted on 27 Jan 2024Home >> Tutorial >> Node.js Tutorial >> Node.js Console

Node.js Console

Node.js Console



When we say about the Node.js console, this module will provides a simple debugging console same as JavaScript console mechanism provided by web browsers.

And below are the three console methods which are used to write any node.js stream:-

(1)console.log()
(2)console.error()
(3)console.warn()

(1)Node.js console/log()



We use console.log() function to display simple message on console.

File: console_example.js


console.log('Hello CrackYourInterview');


Now you need to open Node.js command prompt and run the following code to call console_example.js file.


node console_example.js




output brower nodejs/>

We can also use format specifier in console.log() function and below is the function and the filename.

File: console_example1.js

console.log('Hello %s','CrackYourInterview');

Now need to open Node.js command prompt and neew to run the below command to execute the file console_example1.js:-

node console_example1.js



SpecifierConsole


(2)Node.js console.error()



Well console.error() function is mainly used to rendor error message on the console.

File: console_example2.js

console.error(new Error('Hi! this is wrong method'));

Now you will open Node.js command prompt and run the follwoing code:

node console_example2.js



Error Console


(3)Node.js console.warn()



Well console.warn() function is mainly used to display warning message on the console.

File: console_example3.js

const name ='Pau';
console.warn('You are not doing well $(name)! so correct your input!');


Now you need to open Node.js command prompt and run the below code:-

node console_example3.js



Error Console
0
0



.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

Parts of Node.js

Install Node.js Linux

Node.js First Example

Node.js Globals

Node.js DNS






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap