crackyourinterview.com


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

Node.js console.time()
Question Posted on 08 May 2024Home >> Tutorial >> Node.js Tutorial >> Node.js console.time()

Node.js console.time()

Node.js console.time() Method


When we say about the console close of node.js, console.time() is method is also a console class. And we can used timer to compute the time taken by any piece of code or function. And method console.timeEnd() is used to stop the timer and then the output of elapsed time in milliseconds to stdout. And the timer can be accurate to the sub-millisecond.

And syntax of console.time method is:-'

console.time ( label )



And when we say about the Parameter, this will accepts a single parameter label which can be passed in the method as parameter. And if we not passed the label then a default label is automatically given to the method. And label can be different for different functions or the pieces of code.

Below we have tried to give one example to use of time() method. I have save the below code in .js file and name this file as TimerUsed.js:-


console.time
To download code
click here

Now we run above file in Node.js command prompt as per the below command:-


Node TimerUsed.js



And output of above command is given below:-




console.time output

Now example two and use of Label in console.time() method. And create a below code file and name that file as "TimerUsedLabel.js".
console.time multi label
To view the code Download Code
Now we run above file in Node command prompt as per the below command:-


Node TimerUsedLabel.js



And output of above command is given below:-

multi label node.js

We will take one more example which have 2 labels and time() method use below is code file which name as MultiTimeLabel.js.
multi label node.js
To view the code Download Code
Now we run above file in Node command prompt as per the below command:-


Node MultiTimeLabel.js



And output of above command is given below:-


Multi Label Time
0
0




.


Most Visited Questions:-

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

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript 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...

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