Node.js console.timeEnd() Method Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report The console.timeEnd() method is the console class of Node.js. This method stops a timer that was previously started by using console.time() method and display the result using stdout. Syntax: console.timeEnd( label ) Parameter: This method accepts a single parameter label that holds the string value. If the label is not passed i.e the value of the label is default then it is automatically given to the method. The label can different for different functions or pieces of code. Return Value: This method displays the label and the time taken by a piece of code. Example 1: The below example illustrates the console.timeEnd() method in Node.js: javascript // Node.js program to demonstrate the // console.timeEnd() method // Sample function function addCount() { let sum = 0; // Variable declaration for (let i = 1; i < 100000; i++) { sum += i; // Adding i to the sum variable } return sum; // Return sum value } // Starts the timer, here default label is used console.time(); addCount(); // function call // Ends the timer and print the time // taken by the piece of code console.timeEnd(); Output: default: 7.517ms Example 2: The below example illustrates the console.timeEnd() method in Node.js: javascript // Node.js program to demonstrate the // console.timeEnd() method // Sample function function addCount() { let sum = 0; // Variable declaration for (let i = 1; i < 100000; i++) { sum += i; // Adding i to the sum variable } return sum; // Return sum value } let timetaken = "Time taken by addCount function"; // Starts the timer, the label value is timetaken console.time(timetaken); addCount(); // function call // Ends the timer and print the time // taken by the piece of code console.timeEnd(timetaken); Output: Time taken by addCount function: 8.972ms Reference: https://nodejs.org/docs/latest-v11.x/api/console.html#console_console_timeend_label Create Quiz Comment A akshajjuneja9 Follow 0 Improve A akshajjuneja9 Follow 0 Improve Article Tags : Web Technologies Node.js Node.js-console-module Explore Introduction & Installation NodeJS Introduction3 min readNode.js Roadmap: A Complete Guide6 min readHow to Install Node.js on Linux6 min readHow to Install Node.js on Windows5 min readHow to Install NodeJS on MacOS6 min readNode.js vs Browser - Top Differences That Every Developer Should Know6 min readNodeJS REPL (READ, EVAL, PRINT, LOOP)4 min readExplain V8 engine in Node.js7 min readNode.js Web Application Architecture3 min readNodeJS Event Loop5 min readNode.js Modules , Buffer & StreamsNodeJS Modules5 min readWhat are Buffers in Node.js ?4 min readNode.js Streams4 min readNode.js Asynchronous ProgrammingAsync Await in Node.js3 min readPromises in NodeJS7 min readHow to Handle Errors in Node.js ?4 min readException Handling in Node.js3 min readNode.js NPMNodeJS NPM6 min readSteps to Create and Publish NPM packages7 min readIntroduction to NPM scripts2 min readNode.js package.json4 min readWhat is package-lock.json ?3 min readNode.js Deployments & CommunicationNode Debugging2 min readHow to Perform Testing in Node.js ?2 min readUnit Testing of Node.js Application5 min readNODE_ENV Variables and How to Use Them ?2 min readDifference Between Development and Production in Node.js3 min readBest Security Practices in Node.js4 min readDeploying Node.js Applications5 min readHow to Build a Microservices Architecture with NodeJS3 min readNode.js with WebAssembly3 min readResources & ToolsNode.js Web Server6 min readNode Exercises, Practice Questions and Solutions4 min readNode.js Projects9 min readNodeJS Interview Questions and Answers15+ min read Like