From b5461b9128a5dc89b3ceac6795f0c75c71f837a1 Mon Sep 17 00:00:00 2001 From: mayravargasbecerra13 Date: Thu, 28 Jul 2022 16:48:36 -0500 Subject: [PATCH 1/4] Agrego primer ejercicio de javarcript --- 1-syntax-basic-constructs/basic-js.html | 15 +++++++++++++++ 1-syntax-basic-constructs/basic.js | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 1-syntax-basic-constructs/basic-js.html create mode 100644 1-syntax-basic-constructs/basic.js diff --git a/1-syntax-basic-constructs/basic-js.html b/1-syntax-basic-constructs/basic-js.html new file mode 100644 index 0000000..a6518b5 --- /dev/null +++ b/1-syntax-basic-constructs/basic-js.html @@ -0,0 +1,15 @@ + + + + + + + Document + + + + + + + + \ No newline at end of file diff --git a/1-syntax-basic-constructs/basic.js b/1-syntax-basic-constructs/basic.js new file mode 100644 index 0000000..8054ffe --- /dev/null +++ b/1-syntax-basic-constructs/basic.js @@ -0,0 +1,9 @@ +const edad = prompt ('Ingrese su edad:') +function mayorEdad(edad) { + if (edad > 18 ){ + alert('mayor edad') +}else { + alert('Es menor de edad') +} +} +mayorEdad(edad) From c8167bdfc1457e3b607be9fd70051065ba1fa368 Mon Sep 17 00:00:00 2001 From: mayravargasbecerra13 Date: Tue, 9 Aug 2022 10:33:32 -0500 Subject: [PATCH 2/4] Add fetch --- 1-syntax-basic-constructs/basic.js | 8 +++++--- 3-fetch-api-ajax/fetch.html | 13 +++++++++++++ 3-fetch-api-ajax/fetch.js | 17 +++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 3-fetch-api-ajax/fetch.html create mode 100644 3-fetch-api-ajax/fetch.js diff --git a/1-syntax-basic-constructs/basic.js b/1-syntax-basic-constructs/basic.js index 8054ffe..1534a5f 100644 --- a/1-syntax-basic-constructs/basic.js +++ b/1-syntax-basic-constructs/basic.js @@ -1,9 +1,11 @@ const edad = prompt ('Ingrese su edad:') function mayorEdad(edad) { if (edad > 18 ){ - alert('mayor edad') -}else { - alert('Es menor de edad') + alert('mayor edad') + } else { + alert('Es menor de edad') } } mayorEdad(edad) + + diff --git a/3-fetch-api-ajax/fetch.html b/3-fetch-api-ajax/fetch.html new file mode 100644 index 0000000..5bfc9a4 --- /dev/null +++ b/3-fetch-api-ajax/fetch.html @@ -0,0 +1,13 @@ + + + + + + + Fetch + + + + + + \ No newline at end of file diff --git a/3-fetch-api-ajax/fetch.js b/3-fetch-api-ajax/fetch.js new file mode 100644 index 0000000..6721466 --- /dev/null +++ b/3-fetch-api-ajax/fetch.js @@ -0,0 +1,17 @@ +async function personajes() { + let data = await fetch("https://swapi.dev/api/people/"); + let response = await data.json(); + return response.results; +} + +(async () => { + let personajeslista = await personajes(); + + const groupBygender = personajeslista.reduce((group, person) => { + const { gender } = person; + group[gender] = group[gender] ?? []; + group[gender].push(person.name); + return group; + }, {}); + console.log(groupBygender); +})(); \ No newline at end of file From 05d7e6ace5f723ef0a892223840b69af1a695c6f Mon Sep 17 00:00:00 2001 From: Mayra Vargas <95660831+mayravargasbecerra13@users.noreply.github.com> Date: Tue, 9 Aug 2022 11:12:20 -0500 Subject: [PATCH 3/4] Delete basic-js.html --- 1-syntax-basic-constructs/basic-js.html | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 1-syntax-basic-constructs/basic-js.html diff --git a/1-syntax-basic-constructs/basic-js.html b/1-syntax-basic-constructs/basic-js.html deleted file mode 100644 index a6518b5..0000000 --- a/1-syntax-basic-constructs/basic-js.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - Document - - - - - - - - \ No newline at end of file From 228b7a5ae509c673446ad9689f827c252963ce29 Mon Sep 17 00:00:00 2001 From: Mayra Vargas <95660831+mayravargasbecerra13@users.noreply.github.com> Date: Tue, 9 Aug 2022 11:12:39 -0500 Subject: [PATCH 4/4] Delete basic.js --- 1-syntax-basic-constructs/basic.js | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 1-syntax-basic-constructs/basic.js diff --git a/1-syntax-basic-constructs/basic.js b/1-syntax-basic-constructs/basic.js deleted file mode 100644 index 1534a5f..0000000 --- a/1-syntax-basic-constructs/basic.js +++ /dev/null @@ -1,11 +0,0 @@ -const edad = prompt ('Ingrese su edad:') -function mayorEdad(edad) { - if (edad > 18 ){ - alert('mayor edad') - } else { - alert('Es menor de edad') -} -} -mayorEdad(edad) - -