Skip to content

6 different versions of a js script (using callbacks or promises, and acting sequentially or in parallel) to request three numbers and find their average

Notifications You must be signed in to change notification settings

racheltho/from-callbacks-to-promises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

from-callbacks-to-promises

This project includes 6 versions of a js script to request three random numbers and take their average. The different scripts use callbacks or promises, act sequentially or in parallel, and include a few other refactors (like using underscore js and $.each). Explore the scripts (located in the static/js/ directory) to see many ways to do the same thing. The random numbers are served by a simple flask app that adds a time delay to each request, and the total time taken is displayed.

To serve the random number endpoint, run python get_random.py from the terminal, and then go to http:https://localhost:5000/static/index.html in your browser.

Recommended articles on promises:

About

6 different versions of a js script (using callbacks or promises, and acting sequentially or in parallel) to request three numbers and find their average

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages