JavaScript Countdown done with Vanilla JavaScript This Project is to build a Stop Watch Part of my Vanilla Javascript Project
Steps on how this Project was built:
- First Create the HTML File Boilerplate and link respective css and jacascript files
- Give the body a background color and display it flex to make all items go to the center
- Then create the elements that would hold the stop watch and the control buttons
- Give the elements that hold the countdown an id
- GIve the buttons an identifier
JavaScript:
- Create a DOMContentLoaded function
- Reference all contents and buttons and put them in variables
- Create variables for buttons
- Write the Countdown Method. This methods basically runs a condition and increases the count of the timer
- Write the functions of each button when they are clicked
- The clearInterval method clears the timer with the setTimeout method. It stops the setTimeout after a given period and it runs again and again
- The Interval variable is just used to reference the setTimeout method