Practice with Promises in JavaScript
Use these exercises to practice working with JavaScript Promises.
Stopwatch
Create a simple stopwatch app that starts the timer and shows the stopped time.
- Start the stopwatch with a promise
- End the stopwatch on a random time between 1-10 seconds
- When the stopwatch stops, display the time it took
Stopwatch Solution
The Tortoise and the Hare
Create two animals (a tortoise and a hare) that race each other.
- Start each animals with a separate promise
- End each promise on a random time between 1-10 seconds
- Display the winner (or determine if it's a tie)
- Display the total time it took for each animal
Tortoise and the Hare Solution
Associated Lesson
Lesson Topic | |
---|---|
📝 | Intro to Promises |