const URL = "https://ghibliapi.herokuapp.com/people";
const main = document.getElementById("main");
main.innerHTML = "<p>Loading...";
fetch(URL)
.then((response) => response.json())
.then((people) => main.innerHTML = getListOfNames(people));
const getListOfNames = (people) => {
const names = people
.map((person) => `<li>${person.name}</li>`)
.join("\n");
return `<ul>${names}</ul>`;
};```
-
Notifications
You must be signed in to change notification settings - Fork 0
🔥 Basic code showing how to use Fetch API and Promises
thedvlprs/fetch-api-promises
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
 |  | |||
 |  | |||
 |  | |||
 |  | |||
Repository files navigation
About
🔥 Basic code showing how to use Fetch API and Promises
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published