Last active
July 11, 2019 07:43
-
-
Save sdesalas/8660cdaacc5a411fd4be4cb79631ccdf to your computer and use it in GitHub Desktop.
Promises Mini-Dojo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Frogmore High School - Fetch array, combine and reorder</title> | |
<script> | |
// Step 1: Copy this html file locally as index.html | |
// Step 2: Edit the <script> section to fetch data from these 2 urls | |
// - Students: https://api.myjson.com/bins/vm1oz | |
// - Marks: https://api.myjson.com/bins/fjccz | |
// Step 3: Combine it into one single array by student id | |
// Step 4: Order by last name | |
// Step 5: Print to console (see "result.json") --> 5 points | |
// Extra 2 points: Request both students and marks at same time - with Promise.all() | |
// Extra 2 points: All the .then() statements should be at the same level | |
// Extra 1 point: Catch when there is an error in one of the APIs | |
// Note the following: | |
// - There are 16 students, everyone should have marks for maths and english. | |
// - The output should be ordered by last name, dont worry about ordering by first name (when the last name matches). | |
// - Bob Smith has highest mark for MATHS (9.9) | |
// - Andrew Kimber has highest mark for ENGLISH (8.9) | |
</script> | |
</head> | |
<body> | |
<div> | |
<h1>Frogmore School Grade 8 Class</h1> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{"id":"318977","firstname":"Peter","lastname":"Johnson"}, | |
{"id":"042725","firstname":"Simon","lastname":"Smith"}, | |
{"id":"687756","firstname":"Martha","lastname":"Robertson"}, | |
{"id":"739955","firstname":"William","lastname":"Talbot"}, | |
{"id":"905126","firstname":"Bob","lastname":"Smith"}, | |
{"id":"739559","firstname":"Harry","lastname":"Talbot"}, | |
{"id":"878999","firstname":"Pradosh","lastname":"Brown"}, | |
{"id":"421848","firstname":"Anna","lastname":"Ashley"}, | |
{"id":"073342","firstname":"Melanie","lastname":"Brown"}, | |
{"id":"503297","firstname":"Andrew","lastname":"Kimber"}, | |
{"id":"312366","firstname":"Martha","lastname":"Slater"}, | |
{"id":"519357","firstname":"Harry","lastname":"Smith"}, | |
{"id":"261417","firstname":"Mark","lastname":"O'hara"}, | |
{"id":"438375","firstname":"Roderick","lastname":"Snow"}, | |
{"id":"454278","firstname":"Melanie","lastname":"Young"}, | |
{"id":"233935","firstname":"Benjamin","lastname":"McDonnel"} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{"id":"687756","maths":5,"english":5.2}, | |
{"id":"739955","maths":4.1,"english":3.1}, | |
{"id":"312366","maths":7.3,"english":7.8}, | |
{"id":"519357","maths":5.8,"english":5.2}, | |
{"id":"739559","maths":5.6,"english":6.1}, | |
{"id":"878999","maths":4.7,"english":8.1}, | |
{"id":"421848","maths":4.7,"english":5.5}, | |
{"id":"073342","maths":7.8,"english":4.2}, | |
{"id":"503297","maths":8.3,"english":8.9}, | |
{"id":"318977","maths":9.3,"english":2.3}, | |
{"id":"042725","maths":4.9,"english":8}, | |
{"id":"905126","maths":9.9,"english":3.3}, | |
{"id":"261417","maths":6,"english":8.7}, | |
{"id":"438375","maths":4,"english":4.4}, | |
{"id":"454278","maths":2.4,"english":5.5}, | |
{"id":"233935","maths":5.2,"english":3.1} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{"id":"421848","firstname":"Anna","lastname":"Ashley","maths":4.7,"english":5.5}, | |
{"id":"073342","firstname":"Melanie","lastname":"Brown","maths":7.8,"english":4.2}, | |
{"id":"878999","firstname":"Pradosh","lastname":"Brown","maths":4.7,"english":8.1}, | |
{"id":"318977","firstname":"Peter","lastname":"Johnson","maths":9.3,"english":2.3}, | |
{"id":"503297","firstname":"Andrew","lastname":"Kimber","maths":8.3,"english":8.9}, | |
{"id":"233935","firstname":"Benjamin","lastname":"McDonnel","maths":5.2,"english":3.1} | |
{"id":"261417","firstname":"Mark","lastname":"O'hara","maths":6,"english":8.7}, | |
{"id":"687756","firstname":"Martha","lastname":"Robertson","maths":5,"english":5.2}, | |
{"id":"312366","firstname":"Martha","lastname":"Slater","maths":7.3,"english":7.8}, | |
{"id":"905126","firstname":"Bob","lastname":"Smith","maths":9.9,"english":3.3}, | |
{"id":"519357","firstname":"Harry","lastname":"Smith","maths":5.8,"english":5.2}, | |
{"id":"042725","firstname":"Simon","lastname":"Smith","maths":4.9,"english":8}, | |
{"id":"438375","firstname":"Roderick","lastname":"Snow","maths":4,"english":4.4}, | |
{"id":"739559","firstname":"Harry","lastname":"Talbot","maths":5.6,"english":6.1}, | |
{"id":"739955","firstname":"William","lastname":"Talbot","maths":4.1,"english":3.1}, | |
{"id":"454278","firstname":"Melanie","lastname":"Young","maths":2.4,"english":5.5}, | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment