Skip to content

koda-m/summer-chores

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

☀ Summer Chores ☀

Description

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:

  1. Mowing the yard
  2. Weedeating the edges of the house and fence line
  3. Trimming the hedges
  4. Collect fallen wood for summer night fires
  5. 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

Versions

This project has three separate versions:

  1. callbackVersion.js – uses callbacks
  2. promiseVersion.js – uses promises
  3. asyncAwaitVersion.js – uses async/await

How to Run

How to run callbackVersion.js:

  1. Make sure you have Node.js installed (download here: https://nodejs.org/en).
  2. Clone or download this repo.
  3. Open a terminal and navigate to the summer-chores folder.
  4. Run the script with Node.js by typing the command node callbackVersion.js into the terminal and pressing Enter.

How to run promiseVersion.js:

  1. Make sure you have Node.js installed (download here: https://nodejs.org/en).
  2. Clone or download this repo.
  3. Open a terminal and navigate to the summer-chores folder.
  4. Run the script with Node.js by typing the command node promiseVersion.js into the terminal and pressing Enter.

How to run asyncAwaitVersion.js:

  1. Make sure you have Node.js installed (download here: https://nodejs.org/en).
  2. Clone or download this repo.
  3. Open a terminal and navigate to the summer-chores folder.
  4. Run the script with Node.js by typing the command node asyncAwaitVersion.js into the terminal and pressing Enter.

About

This project explores callbacks, promises, and async/await to illustrate how asynchronous JavaScript works

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors