YouTip LogoYouTip

Met Console Timeend

# HTML DOM console.timeEnd() Method [![Image 3: Console Object](#) Console Object](#) ## Example The actual time taken to execute 100,000 times: console.time(); for(i = 0; i<100000; i++){// Code part}console.timeEnd(); [Try it Β»](#) * * * ## Definition and Usage The console.timeEnd() method is the ending method for a timer. This method is generally used to test the duration of program execution. The [console.time()](#) method is the starting method for the timer. If a page needs to use multiple timers, you can add a label parameter to set them apart. **Note:** To test this method, the console must be visible (press F12 in the browser to open the console). * * * ## Syntax console.timeEnd(label) * * * ## Browser Support The numbers in the table specify the first browser version that fully supports the method. | Method | | | | | | | --- | --- | --- | --- | --- | --- | | console.timeEnd() | Yes | 11 | 10 | 4 | Yes | * * * ## Parameter Description | Parameter | Type | Description | | --- | --- | --- | | _label_ | String | Optional. Used to set a label for the timer. | | _tablecolumns_ | Array | Optional. An array of names for the table header columns. | * * * ## More Examples ## Example Using the label parameter: console.time("Tutorial"); for(i = 0; i<100000; i++){// Code part}console.timeEnd("Tutorial); [Try it Β»](#) ## Example Testing which code executes faster var i; console.time("for loop test:"); for(i = 0; i<100000; i++){// Code part}console.timeEnd("for loop end."); i = 0; console.time("while loop test:"); while(i<1000000){i++ }console.timeEnd("while loop test end."); [Try it Β»](#) [![Image 4: Console Object](#) Console Object](#)
← Met Console WarnMet Console Table β†’