Use instructions for the console.time method in node.js

  • 2020-03-30 04:33:37
  • OfStack

Method description:

Start time, corresponding to console.timeEnd, records the time period.

Grammar:


console.time(label)

Receiving parameters:

Label                        Corresponds to the label of the start time console.log

Example:


console.time('100-elements');
for (var i = 0; i < 100; i++) {
  ;
}
console.timeEnd('100-elements');

Source:


Console.prototype.time = function(label) {
  this._times[label] = Date.now();
};


Related articles: