Bob has a list of summer chores to do every Saturday. There are a lot of chores for him to do, and naturally, he gets more tired while completing his tasks. If he gets too tired, he might fall asleep before completing all the chores.
He has a strict routine, which follows in order:
- Mowing the yard
- Weedeating the edges of the house and fence line
- Trimming the hedges
- Collect fallen wood for summer night fires
- Water the garden
If he manages not to get tired and fall asleep while doing his chores, he will have successfully completed his chores. Also, there's never a chance of him falling asleep before mowing the yard.
Time to Complete Chores| Chore | Time to Complete (milliseconds) |
|---|---|
| Time to mow the yard. | 2000 |
| Time to weed eat the yard. | 1500 |
| Time to trim the hedges. | 1000 |
| Time to collect wood. | 2500 |
| Time to water the garden. | 500 |
This project has three separate versions:
- callbackVersion.js – uses callbacks
- promiseVersion.js – uses promises
- asyncAwaitVersion.js – uses async/await
- Make sure you have Node.js installed (download here: https://nodejs.org/en).
- Clone or download this repo.
- Open a terminal and navigate to the summer-chores folder.
- Run the script with Node.js by typing the command
node callbackVersion.jsinto the terminal and pressing Enter.
- Make sure you have Node.js installed (download here: https://nodejs.org/en).
- Clone or download this repo.
- Open a terminal and navigate to the summer-chores folder.
- Run the script with Node.js by typing the command
node promiseVersion.jsinto the terminal and pressing Enter.
- Make sure you have Node.js installed (download here: https://nodejs.org/en).
- Clone or download this repo.
- Open a terminal and navigate to the summer-chores folder.
- Run the script with Node.js by typing the command
node asyncAwaitVersion.jsinto the terminal and pressing Enter.