Open HerbertHomolka1 opened 1 year ago
## What went less well?
should produce the following formatted text:
You should be able to see it, it's something you wrote.
@HerbertHomolka1 as for the url where to put it , you can put it in your apis function or your data.js as for then
const getUsers = () => {
return fetch(`https://jsonplaceholder.typicode.com/users`)
.then((res) => {
if (!res.ok) {
throw new Error(
`Failed to fetch users with status: ${res.status}`,
);
}
return res.json(); // convert the response to a JavaScript object
})
.catch((Error) => {
console.error(err);
return null;
});
};
const needData = (data) => {};
const HandlerUser = () => {
getUsers().then((data) => {
console.log(data); // you will get here what ever the first then return so in this case data
// here you can do whatever you want with your data , you can loop throw them because they are an array in this case
// you can pass them to another function if you want to
needData(data);
});
};
HandlerUser();
there are a lot of examples on my gitHub account check them.
Asynchronous Programming
Learning Objectives
setTimeout
andsetInterval
to schedule simple tasks.fetch
data from RESTful APIs..then
Promise.all
system./api-calls
,/handlers
andasync
/await
syntax.async
/await
syntax.Week 1
I Need Help With:
nothing
What went well?
I understand the js event loop
What went less well?
Lessons Learned
Week 2
I Need Help With:
I would like to practice a little with other students. Eben has time after class this sunday
What went well?
It was a bad week. I am sorry
What went less well?
Lessons Learned
Week 3
I Need Help With:
What went well?
I managed to make a working Get Joke App, although I will still work on it today (friday) to add more user options.
What went less well?
Lessons Learned