Home > Web Front-end > JS Tutorial > body text

Instructions for using the console.timeEnd method in node.js_node.js

WBOY
Release: 2016-05-16 16:28:04
Original
1632 people have browsed it

Method description:

Completion time, the time spent between executing console.time and console.timeEnd.

Grammar:

Copy code The code is as follows:

console.timeEnd(label)

Receive parameters:

Label corresponds to the label of console.log at the start time

Example:

Copy code The code is as follows:

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

Source code:

Copy code The code is as follows:

Console.prototype.timeEnd = function(label) {
var time = this._times[label];
if (!time) {
Throw new Error('No such label: ' label);
}
var duration = Date.now() - time;
This.log('%s: %dms', label, duration);
};
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template