Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
general knowledge
ASP.NET
VB.NET
SQL Query
UDDI
CLASS
JavaScript Questions
SharePoint Interview
SilverLight
WCF
 AngularJS
 :) Hot Jobs
 
 :) Latest Articles


  

 


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

Home >> 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



 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


Other Important Questions
Parts of Node.js
Install Node.js Linux
Node.js First Example
Node.js Globals
Node.js DNS






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |