Add basis for exercise as well as task description

This commit is contained in:
Julius Freudenberger 2025-11-19 23:24:55 +01:00
parent c449843941
commit 41ae601c19
9 changed files with 200 additions and 1 deletions

17
js/continents.js Normal file
View file

@ -0,0 +1,17 @@
const continentList = document.getElementById("continent-list");
fetch("https://countries.trevorblades.com/", {
method: "POST",
body: JSON.stringify(
{
query: "", // Fill in Query here
"operationName": "allContinents"
}),
headers: { "Content-Type": "application/json" }
}).then(response => response.json()).then(({ data }) => {
const continents = data.continents;
for (const continent of continents) {
const newListItem = document.createElement("li");
newListItem.innerHTML = `<a href="/continent.html?code=${continent.code}"> ${continent.name} </a>`;
continentList.append(newListItem);
}
});