• Home
  • Resume
  • CV PDF
  • Portfolio
    • PHP Factory Pattern | PHP/OOP/Design Patterns
    • User validation form | PHP/OOP/HTML
    • Pizza Fanatic App | PHP/MySQL
    • Raspberry Pi Robot | RaspberryPi/Python
    • Commercial in Confidence | MySQL/PHP/AJAX
    • Gazetteer Geolocation | APIs/cURL/PHP/AJAX
    • Wasteman Clearance | Bootstrap/JS
    • Paddy Boyle Photos | Node.js
    • Paddy Boyle Photography | Node.js
    • Jackie Ceramics Site | Bootstrap
    • My Website | Node.js/Express/HBS
    • Phoenix Beading Site | Bootstrap
    • Neighbourhood Site | Bootstrap
    • GitHub Profiler API | AJAX/jQuery
    • AJAX CRUD Requests | AJAX/jQuery/Node.js
    • Geolocation App/API | AJAX/PHP/CURL/JSON
    • Json Generator App | AJAX
    • Musicon Site | Handlebars
    • Rock Paper Scissors App | JS
    • PHP Calculator App | PHP
    • Race Registration App | JS
    • Magic Eight Ball App | JS
    • Games of Chance App | JS
    • Tasty Treats Form | Node.js
    • React Exercise | Node.js/React
    • Bitesize API | AJAX
    • Wordsmith API | AJAX
    • Piano Keys App | jQuery
    • Gameboard App | jQuery
    • Web Safe Font App | jQuery
    • Feedster App | PHP
    • Madison Site | jQuery
    • Task List | Python/Flask
    • Trivia Card | jQuery
    • Academia Stats | DC.js/Crossfilter
    • Connect Four Game | jQuery
    • DRY App | Bootstrap
    • Silent Signs | JS/Bootstrap
    • Tic Tac Toe Game | JS
    • Stopwatch App | JS
    • CSS Poster | HTML5/CSS3
  • Git Hub
  • Contact
Jed Boyle logo

Jed Boyle

Full Stack Developer

Jed Boyle logo

Jed Boyle

Full Stack Developer

  • Home
  • Resume
  • CV PDF
  • Portfolio
  • GIT HUB
  • Contact
Jed Boyle logo

Jed Boyle

Full Stack Developer

  • Home
  • Resume
  • CV PDF
  • Portfolio
  • GIT HUB
  • Contact

Stopwatch App

Stopwatch App

https://jboyle1.github.io/test-stopwatch/
Previous Next

Project Description


This project was a technical test for an interview. It was a front end task focusing on HTML, javascript and CSS. The task was to create a stopwatch using HTML and vanilla Javascript.

I initially created ID elements in the HTML that I could target in the Javascript inside variables using the browser object model (BOM) ‘document.’ and the getElementByID method. Then create a function that has an ‘if’ statement that iterates through milliseconds, seconds, minutes and hours.

After I had this in place I needed to outsource for some help. I used www.stackoverflow.com to get some advice and what I had was pretty close. I was advised to add ternary operators to the function. Using h1.textContent property to target HTML h1 tag contents.

I then created an onclick event handler for the start button called ‘start’ that invokes a function called timer() which then sets the t variable to setTimeout(add, 10). This starts the add() function.

Then another onclick event handler for the stop button which invokes an anonymous function that uses the clearTimeout() method that clears a timer set with the setTimeout() method.

Lastly one last onclick event handler for the clear button which invokes an anonymous function that resets the h1.textContent to ‘0’ also sets all the variables back to zero.

I styled the stopwatch program using vanilla css (no framework). I simply used HTML tags to center the DRO and buttons and used a linear gradient for the background colour. I used a hover pseudo class to add a hover effect to the buttons when the mouse hovers over it.

Although I needed some help to get this script to operate I feel that I learned along the way and feel that my Javascript skills increased. I needed to aim to spendapproximately 2 hours on this task. It took about three hours including a bit of planning out.

Click here for GitHub repository



Project Description


This project was a technical test for an interview. It was a front end task focusing on HTML, javascript and CSS. The task was to create a stopwatch using HTML and vanilla Javascript.

I initially created ID elements in the HTML that I could target in the Javascript inside variables using the browser object model (BOM) ‘document.’ and the getElementByID method. Then create a function that has an ‘if’ statement that iterates through milliseconds, seconds, minutes and hours.

After I had this in place I needed to outsource for some help. I used www.stackoverflow.com to get some advice and what I had was pretty close. I was advised to add ternary operators to the function. Using h1.textContent property to target HTML h1 tag contents.

I then created an onclick event handler for the start button called ‘start’ that invokes a function called timer() which then sets the t variable to setTimeout(add, 10). This starts the add() function.

Then another onclick event handler for the stop button which invokes an anonymous function that uses the clearTimeout() method that clears a timer set with the setTimeout() method.

Lastly one last onclick event handler for the clear button which invokes an anonymous function that resets the h1.textContent to ‘0’ also sets all the variables back to zero.

I styled the stopwatch program using vanilla css (no framework). I simply used HTML tags to center the DRO and buttons and used a linear gradient for the background colour. I used a hover pseudo class to add a hover effect to the buttons when the mouse hovers over it.

Although I needed some help to get this script to operate I feel that I learned along the way and feel that my Javascript skills increased. I needed to aim to spendapproximately 2 hours on this task. It took about three hours including a bit of planning out.

Click here for GitHub repository



My Social