From a72fa4c211e46114f44a4d6bd01fda566f7d6d98 Mon Sep 17 00:00:00 2001 From: Michael Lambert Date: Thu, 5 Sep 2024 21:49:32 -0400 Subject: [PATCH 1/2] Cleaned up section on scriptHelper a bit and added a note about async/await --- .../launch-checklist/planet-fetch/_index.md | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/content/assignments/launch-checklist/planet-fetch/_index.md b/content/assignments/launch-checklist/planet-fetch/_index.md index 11e72dc9..2cddff19 100644 --- a/content/assignments/launch-checklist/planet-fetch/_index.md +++ b/content/assignments/launch-checklist/planet-fetch/_index.md @@ -25,11 +25,25 @@ Review the list and decide which planet you want to send our intrepid crew to an {{% /notice %}} In `scriptHelper.js`, you have three functions for this task: `myFetch()`, `pickPlanet()`, and `addDestinationInfo()`. + First, review the comments in `addDestinationInfo()`. -This is the format of the `innerHTML` for the `missionTarget` div, which you can locate using the `document` parameter of `addDestinationInfo()`. -`addDestinationInfo()` does not need to return anything. +This is the format of the `innerHTML` for the `missionTarget` div, which you can locate using the `document` parameter of `addDestinationInfo()`. `addDestinationInfo()` does not need to return anything. + `pickPlanet()` takes in one argument: a list of planets. Using `Math.random()`, return one planet from the list with a randomly-selected index. -`myFetch()` has some of the code necessary for fetching planetary JSON, however, it is not complete. You need to add the URL and return `response.json()`. + +`myFetch()` has some of the code necessary for fetching planetary JSON, however, it is not complete. You need to add the URL to the `fetch` method call and return `response.json()` from the inner function. + + +{{% notice blue "Note" "rocket" %}} + + `myFetch` has an `async` prefix prior the function declaration, and also uses the `await` keyword + in the body. + + This is an advanced language feature used by the autograder that you do not need to worry about for + class. + +{{% /notice %}} + Now it is time to make use of these helper functions in `script.js`. We provided some of the code necessary: From 26f77c6eb693fa5768e8900861822c3c1d290d47 Mon Sep 17 00:00:00 2001 From: Michael Lambert Date: Fri, 6 Sep 2024 12:13:24 -0400 Subject: [PATCH 2/2] Fixed notice block formatting --- .../launch-checklist/planet-fetch/_index.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/content/assignments/launch-checklist/planet-fetch/_index.md b/content/assignments/launch-checklist/planet-fetch/_index.md index 2cddff19..3adcb457 100644 --- a/content/assignments/launch-checklist/planet-fetch/_index.md +++ b/content/assignments/launch-checklist/planet-fetch/_index.md @@ -17,11 +17,9 @@ Our planetary data can be found in [JSON format](https://handlers.education.laun Review the list and decide which planet you want to send our intrepid crew to and make note of the index number. {{% notice blue "Note" "rocket" %}} - - When fetching more than one JSON object, we get an array of all of the JSON objects. - In this case, that means an array of our possible mission destinations. - When picking the mission destination, just pick the item in the array you want and start counting at 0. - +When fetching more than one JSON object, we get an array of all of the JSON objects. +In this case, that means an array of our possible mission destinations. +When picking the mission destination, just pick the item in the array you want and start counting at 0. {{% /notice %}} In `scriptHelper.js`, you have three functions for this task: `myFetch()`, `pickPlanet()`, and `addDestinationInfo()`. @@ -35,13 +33,11 @@ This is the format of the `innerHTML` for the `missionTarget` div, which you can {{% notice blue "Note" "rocket" %}} +`myFetch` has an `async` prefix prior the function declaration, and also uses the `await` keyword +in the body. - `myFetch` has an `async` prefix prior the function declaration, and also uses the `await` keyword - in the body. - - This is an advanced language feature used by the autograder that you do not need to worry about for - class. - +This is an advanced language feature used by the autograder that you do not need to worry about for +class. {{% /notice %}}