Skip to content

Commit 6af9483

Browse files
markstosbnoordhuis
authored andcommitted
doc: document time() and timeEnd() relationship
`console.time()` and `console.timeEnd()` are very closely related. It's useful to reference them both from each other. Previously, console.time() did not mention that it needed to be paired with a call to console.timeEnd() to be useful, and timeEnd() also failed to mention that console.time() needed to be called first. References in both directions have been added. PR-URL: #198 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 0a8e987 commit 6af9483

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

doc/api/console.markdown

+10-2
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,19 @@ Defaults to `false`. Colors are customizable, see below.
6464

6565
## console.time(label)
6666

67-
Mark a time.
67+
Used to calculate the duration of a specific operation. To start a timer, call
68+
the `console.time()` method, giving it a name as only parameter. To stop the
69+
timer, and to get the elapsed time in miliseconds, just call the
70+
[`console.timeEnd()`](#console_console_timeend_label) method, again passing the
71+
timer's name as the parameter.
6872

6973
## console.timeEnd(label)
7074

71-
Finish timer, record output. Example:
75+
Stops a timer that was previously started by calling
76+
[`console.time()`](#console_console_time_label) and print the result to the
77+
console.
78+
79+
Example:
7280

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

0 commit comments

Comments
 (0)