From 4742a19a3c0e74cce6206b64da7bcc325e2d3f9d Mon Sep 17 00:00:00 2001 From: Jude Date: Sat, 19 Mar 2022 08:56:42 +0000 Subject: [PATCH] updating commit --- exercises/1-debugging-quiz/task.md | 7 +++++++ exercises/3-what-are-APIs/task.md | 13 +++++++++++++ .../4-how-to-use-fetch/country-exercise/script.js | 14 ++++++++++---- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/exercises/1-debugging-quiz/task.md b/exercises/1-debugging-quiz/task.md index 9f47115..ad89f48 100644 --- a/exercises/1-debugging-quiz/task.md +++ b/exercises/1-debugging-quiz/task.md @@ -5,7 +5,14 @@ Let's see what you remember from last week! You should answer in a _thread_ on Slack 1. What are the four questions we ask ourselves in the Debugging Framework? + 2. What are three of the tools we could use to debug our programs? + 3. What is a `syntax` error? + An error in the syntax of a coding or programming language \_ ESLint does nto detect these + 4. What is a `reference` error? + An error when a variable does not eist (or hasn't yet been initialized) in the current scope is referenced. + 5. What is a `type` error? + An error when an operation could not be performed, diff --git a/exercises/3-what-are-APIs/task.md b/exercises/3-what-are-APIs/task.md index ce5aaa1..326bfab 100644 --- a/exercises/3-what-are-APIs/task.md +++ b/exercises/3-what-are-APIs/task.md @@ -19,12 +19,25 @@ Which of the statements below about APIs are false? - C) APIs can control access to data or features of an application. - D) You can change data via an API. +~true + ### QUESTION 2 Give an example of a company that uses an API to allow access to their data. +~false + ### QUESTION 3 What is the `myapi/` part of a url called in this url? `http://www.google.com/**myapi**/` + +~ true - get post put patch (updating a comment delete + +API +true +false - can use any programme +true - +true - get post put patch (updating a comment delete +city Mapper Api diff --git a/exercises/4-how-to-use-fetch/country-exercise/script.js b/exercises/4-how-to-use-fetch/country-exercise/script.js index e2b3689..fc7b430 100644 --- a/exercises/4-how-to-use-fetch/country-exercise/script.js +++ b/exercises/4-how-to-use-fetch/country-exercise/script.js @@ -1,5 +1,13 @@ // This function should retrieve the JSON from the `countryURL` and then call onCountryDataReceived() with the JSON -function getData(countryURL) {} +function getData(countryURL) { + fetch(countryURL) + .then((Response) => { + return Response.json(); + }) + .then((jason) => { + onCountryDataReceived(json); + }); +} function onCountryDataReceived(country) { addCountryName(country); @@ -21,9 +29,7 @@ function getContentDiv() { } function onLoad() { - getData( - "https://restcountries.com/v3.1/name/Great%20Britain" - ); + getData("https://restcountries.com/v3.1/name/Great%20Britain"); /** Remove this line when you have completed the task