Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reto #10 - JavaScript #6677

Merged
merged 1 commit into from
Oct 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Retos/Reto #10 - LA API [Media]/javascript/andres4715-gif.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Llamar a una API es una de las tareas más comunes en programación.
*
* Implementa una llamada HTTP a una API (la que tú quieras) y muestra su
* resultado a través de la terminal. Por ejemplo: Pokémon, Marvel...
*
* Aquí tienes un listado de posibles APIs:
* https://github.com/public-apis/public-apis
*/

const myMethod = async () => {
const request = await fetch('https://reqres.in/api/users?page=1', {
method: 'GET',
});
return request;
};

const response = async () => {
const response = await myMethod();
const jsonData = await response.json();
const data = jsonData.data;
console.log(data);
};

const main = () => {
response();
};

main();