In this project we are going to make a Stopwatch using javascript
Stopwatch will be able to show number of seconds and microsecond passed.
Accuracy of second in stopwatch will be 10/1000 instead of 1/1000 because if you dont have good
hardware it may lack time or it may not show true timing because of heavy.
It will have four buttons to control timing. Start, Lap, Stop and Clear.
Time laps will be shown just below the stopwatch.
Requirements:
You must be familiar with using functions with javascript events.
You must be familiar with javascript prebuilt timing functions eg: setTimeout(), setInterval(), clearTimeout() etc.
Must be familiar with using javascript DOM.
Challenge:
If you want to do it with description and guidelines above, you can try our
Editor above.
Project view must look like below in image:
Guides:
First create a container for whole stopwatch, Inside which create seperate container for each parts.
define global variables: var sec=0, ms=0, interval=false, laparr=[];
Write seperate functions for each functionalities: start(), stop(), lap(), clear:clea() and timer().
If you want to take a challenge don't scroll below
javascript source code for stopwatch
Challenge-2:
Add extra minute section in stopwatch.
guide: First define global variable min, Then add a functionality such that when sec==60, min=min+1, sec=0;