At that point we will make a commencement. While running the commencement our advancement bar will get stacked with time.
With the end goal to make this advancement bar commencement or switch stopwatch, we have to complete a few things.
As a matter of first importance, we need to make an advancement bar. How about we do it.
<progress value="0" max="10" id="pbar" ></progress>
Here esteem is relegated with zero since we need to begin the advancement bar counter with zero.
Max esteem is here 10. The advancement bar begins with zero and can go up to 10.
In this p label territory, we going to print 10 and afterward 9 and 8 et cetera. That implies a commencement like 10 9 8 7 6 5 4 3 2 1 0
You may likewise get interset in,
We have utilized setInterval capacity to call a capacity at indicated interims.
1000 is our interim time in milliseconds or we can state it as a one-moment interim.
As it is a commencement of 10 seconds in this precedent so advance bar max incentive to be 10 and interim to be 1 seconds. In this manner 10/1= 10, You can either set the advancement bar max incentive to 100 and interim to be 100 milliseconds. The outcome will be the equivalent yet the thing that matters is that for this situation, the commencement will be from 100 to 0 and an opportunity to execute the commencement will be 10 seconds.
I will propose you to change the estimations of interim time and advancement bar max incentive to perceive how this is functioning. It will assist you with understanding effortlessly.
The underneath is the case of the basic commencement with onclick catch. Simply test it on your program and adjust according to your desire to have some good times.
Here is the full code.