Making a Stopwatch in Vanilla JavaScript

David Landup
Marcus Sanatan

For this project, we're going to build a stopwatch. A stopwatch records the amount of time that's elapsed between pressing a start button and pressing a stop button. Imagine a sprinter training for a competition. Their trainer would record their runs with a stopwatch to see how fast they're going. Or a more likely scenario for software developers, you may be doing contract work which you charge by the hour. In that case, you'll use some sort of stopwatch to capture the moments when you're working and when you're not!

We'll be using this project to highlight arrow functions. JavaScript provides many ways to create functions, and arrow functions are all the rage since they were introduced as part of ES2015. While they're simple to use, developers have a hard time understanding what kinds of problems they solve, and how they solve those problems.

The popularity of JavaScript nowadays may hide its long history of being the butt of jokes amongst developers. It was common for developers to nitpick at various behaviors of the language and snobbily deride JavaScript as "not a real language". I once fell into those camps of developers. While maturity had a part to play in why I've stopped making such remarks, I've realized just how much JavaScript was misunderstood. To help you avoid my mistakes, we'll be using this app to go over two key concepts in JavaScript - context and scope.

Start project to continue
Lessson 1/2
You must first start the project before tracking progress.
Mark completed

© 2013-2024 Stack Abuse. All rights reserved.

AboutDisclosurePrivacyTerms