From 53adcd6c1376b06f3b974c832c54b2a17ca18540 Mon Sep 17 00:00:00 2001 From: sergioatk <55900410+sergioatk@users.noreply.github.com> Date: Sat, 16 Nov 2019 12:47:37 -0300 Subject: [PATCH 1/9] crea archivos clase 6 crea los archivos para empezar a trabajar sobre la tarea de la clase 6 --- tareas/clase-6/tarea-6-sergio.html | 25 ++++++++++++++++++++++ tareas/clase-6/tarea-6-sergio.js | 33 ++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 tareas/clase-6/tarea-6-sergio.html create mode 100644 tareas/clase-6/tarea-6-sergio.js diff --git a/tareas/clase-6/tarea-6-sergio.html b/tareas/clase-6/tarea-6-sergio.html new file mode 100644 index 00000000..115d3e8a --- /dev/null +++ b/tareas/clase-6/tarea-6-sergio.html @@ -0,0 +1,25 @@ + + + + + + + Clase 6 + + + +

Calculadora de la familia

+ +
+

+ + +
+ + +
+ +
+ + + diff --git a/tareas/clase-6/tarea-6-sergio.js b/tareas/clase-6/tarea-6-sergio.js new file mode 100644 index 00000000..e86646af --- /dev/null +++ b/tareas/clase-6/tarea-6-sergio.js @@ -0,0 +1,33 @@ +/* +TAREA: Empezar preguntando cuánta gente hay en el grupo familiar. +Crear tantos inputs+labels como gente haya para completar la edad de cada integrante. +Al hacer click en "calcular", mostrar en un elemento pre-existente la mayor edad, +la menor edad y el promedio del grupo familiar. + +Punto bonus: Crear un botón para "empezar de nuevo" que empiece el proceso nuevamente, + borrando los inputs ya creados (investigar cómo en MDN). +*/ + + +let $botonOk = document.querySelector('#boton-ok'); +let divFamilia = document.querySelector('#div-familia'); +$botonOk.onclick = function(){ + + let cantidadIntegrantes = Number(document.querySelector('#cantidad-integrantes').value); + console.log(cantidadIntegrantes); + + for (i= 0; i < cantidadIntegrantes.length; i++){ + let div = document.createElement('div'); + let label = document.createElement('label'); + label.textContent = 'Edad del integrante nro'; + + div.appendChild(label); + divFamilia.appendChild(div); + } + + + + + + return false +} From 49742b8f04e201c63e5fe3bf23385decf6b6fe8f Mon Sep 17 00:00:00 2001 From: sergioatk <55900410+sergioatk@users.noreply.github.com> Date: Sat, 16 Nov 2019 16:22:13 -0300 Subject: [PATCH 2/9] =?UTF-8?q?A=C3=B1ade=20funcionalidad=20al=20boton=20p?= =?UTF-8?q?ara=20crear=20inputs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tareas/clase-6/tarea-clase-6.js | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/tareas/clase-6/tarea-clase-6.js b/tareas/clase-6/tarea-clase-6.js index dc058824..e86646af 100644 --- a/tareas/clase-6/tarea-clase-6.js +++ b/tareas/clase-6/tarea-clase-6.js @@ -1,16 +1,33 @@ /* TAREA: Empezar preguntando cuánta gente hay en el grupo familiar. Crear tantos inputs+labels como gente haya para completar la edad de cada integrante. -Al hacer click en "calcular", mostrar en un elemento pre-existente la mayor edad, la menor edad y el promedio del grupo familiar. +Al hacer click en "calcular", mostrar en un elemento pre-existente la mayor edad, +la menor edad y el promedio del grupo familiar. -Punto bonus: Crear un botón para "empezar de nuevo" que empiece el proceso nuevamente, borrando los inputs ya creados (investigar cómo en MDN). +Punto bonus: Crear un botón para "empezar de nuevo" que empiece el proceso nuevamente, + borrando los inputs ya creados (investigar cómo en MDN). */ -/* -TAREA: -Crear una interfaz que permita agregar ó quitar (botones agregar y quitar) inputs+labels para completar el salario anual de cada integrante de la familia que trabaje. -Al hacer click en "calcular", mostrar en un elemento pre-existente el mayor salario anual, menor salario anual, salario anual promedio y salario mensual promedio. +let $botonOk = document.querySelector('#boton-ok'); +let divFamilia = document.querySelector('#div-familia'); +$botonOk.onclick = function(){ -Punto bonus: si hay inputs vacíos, ignorarlos en el cálculo (no contarlos como 0). -*/ + let cantidadIntegrantes = Number(document.querySelector('#cantidad-integrantes').value); + console.log(cantidadIntegrantes); + + for (i= 0; i < cantidadIntegrantes.length; i++){ + let div = document.createElement('div'); + let label = document.createElement('label'); + label.textContent = 'Edad del integrante nro'; + + div.appendChild(label); + divFamilia.appendChild(div); + } + + + + + + return false +} From 737306e60275da3b09504a11920c0e8e56cd8138 Mon Sep 17 00:00:00 2001 From: sergioatk <55900410+sergioatk@users.noreply.github.com> Date: Sat, 16 Nov 2019 18:20:14 -0300 Subject: [PATCH 3/9] arregla src --- tareas/clase-6/tarea-6-sergio.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tareas/clase-6/tarea-6-sergio.html b/tareas/clase-6/tarea-6-sergio.html index 115d3e8a..ab7b5869 100644 --- a/tareas/clase-6/tarea-6-sergio.html +++ b/tareas/clase-6/tarea-6-sergio.html @@ -16,10 +16,10 @@

Calculadora de la familia

- +

- + From 2ae5214d2d69209a62712c7e2859da4e561d2924 Mon Sep 17 00:00:00 2001 From: sergioatk <55900410+sergioatk@users.noreply.github.com> Date: Sat, 16 Nov 2019 18:49:17 -0300 Subject: [PATCH 4/9] Crea los siguiente imputs y P con resultados --- tareas/clase-6/tarea-6-sergio.js | 33 +++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/tareas/clase-6/tarea-6-sergio.js b/tareas/clase-6/tarea-6-sergio.js index e86646af..0b1e42f5 100644 --- a/tareas/clase-6/tarea-6-sergio.js +++ b/tareas/clase-6/tarea-6-sergio.js @@ -16,18 +16,41 @@ $botonOk.onclick = function(){ let cantidadIntegrantes = Number(document.querySelector('#cantidad-integrantes').value); console.log(cantidadIntegrantes); - for (i= 0; i < cantidadIntegrantes.length; i++){ + for (i= 0; i < cantidadIntegrantes; i++){ let div = document.createElement('div'); let label = document.createElement('label'); - label.textContent = 'Edad del integrante nro'; + let input = document.createElement('input'); + label.textContent = 'Edad del integrante nro ' + (i+1); div.appendChild(label); + div.appendChild(input); divFamilia.appendChild(div); } - - - + let $botonCalcular = document.createElement('button'); + $botonCalcular.innerHTML = 'calcular'; + $botonCalcular.id = 'boton-calcular'; + divFamilia.appendChild($botonCalcular); + + + + $botonCalcular.onclick = function(){ + edadesFamilia = document.querySelectorAll('div > input'); + let arrayEdadesFamilia = []; + let menor; + let mayor = Math.max.apply(arrayEdadesFamilia) + let promedio; + for (let i = 0; i < edadesFamilia.length; i++){ + arrayEdadesFamilia.push(edadesFamilia[i].value); + } + + + let pResultados = document.createElement('p'); + pResultados.textContent = `El mayor es ${mayor}`; + divFamilia.appendChild(pResultados); + + + } return false } From b54170a10b9bcd24dfcc0e672f2abc277a8fabce Mon Sep 17 00:00:00 2001 From: sergioatk <55900410+sergioatk@users.noreply.github.com> Date: Sun, 17 Nov 2019 19:14:13 -0300 Subject: [PATCH 5/9] crea funciones mayor y menor --- tareas/clase-6/tarea-6-sergio.js | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/tareas/clase-6/tarea-6-sergio.js b/tareas/clase-6/tarea-6-sergio.js index 0b1e42f5..52096f6f 100644 --- a/tareas/clase-6/tarea-6-sergio.js +++ b/tareas/clase-6/tarea-6-sergio.js @@ -8,13 +8,32 @@ Punto bonus: Crear un botón para "empezar de nuevo" que empiece el proceso nuev borrando los inputs ya creados (investigar cómo en MDN). */ +function calcularMayor (array){ + let contenedor = array[0]; + for (i = 0; i < array.length; i++){ + if (contenedor < array[i]){ + contenedor = array[i]; + } + } + return contenedor; +} + +function calcularMenor (array){ + let contenedor = array[0]; + for (i = 0; i < array.length; i++){ + if (contenedor > array[i]){ + contenedor = array[i]; + } + } + return contenedor; +} let $botonOk = document.querySelector('#boton-ok'); let divFamilia = document.querySelector('#div-familia'); $botonOk.onclick = function(){ let cantidadIntegrantes = Number(document.querySelector('#cantidad-integrantes').value); - console.log(cantidadIntegrantes); + for (i= 0; i < cantidadIntegrantes; i++){ let div = document.createElement('div'); @@ -37,19 +56,22 @@ $botonOk.onclick = function(){ $botonCalcular.onclick = function(){ edadesFamilia = document.querySelectorAll('div > input'); let arrayEdadesFamilia = []; - let menor; - let mayor = Math.max.apply(arrayEdadesFamilia) - let promedio; + for (let i = 0; i < edadesFamilia.length; i++){ arrayEdadesFamilia.push(edadesFamilia[i].value); } + let menor = calcularMenor(arrayEdadesFamilia); + let mayor = calcularMayor(arrayEdadesFamilia); let pResultados = document.createElement('p'); - pResultados.textContent = `El mayor es ${mayor}`; + + pResultados.textContent = `El mayor es ${mayor}, el menor es ${menor} y el promedio es /////`; divFamilia.appendChild(pResultados); + + } return false From 3e30847fd53a9f7a02307a09d469e4f2c7b046be Mon Sep 17 00:00:00 2001 From: sergioatk <55900410+sergioatk@users.noreply.github.com> Date: Mon, 18 Nov 2019 20:52:11 -0300 Subject: [PATCH 6/9] agrega funcion promedio ( `promedio` esta dando NaN) --- tareas/clase-6/tarea-6-sergio.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tareas/clase-6/tarea-6-sergio.js b/tareas/clase-6/tarea-6-sergio.js index 52096f6f..9940d623 100644 --- a/tareas/clase-6/tarea-6-sergio.js +++ b/tareas/clase-6/tarea-6-sergio.js @@ -8,7 +8,7 @@ Punto bonus: Crear un botón para "empezar de nuevo" que empiece el proceso nuev borrando los inputs ya creados (investigar cómo en MDN). */ -function calcularMayor (array){ +function calcularMayor(array){ let contenedor = array[0]; for (i = 0; i < array.length; i++){ if (contenedor < array[i]){ @@ -18,14 +18,24 @@ function calcularMayor (array){ return contenedor; } -function calcularMenor (array){ +function calcularMenor(array){ let contenedor = array[0]; for (i = 0; i < array.length; i++){ if (contenedor > array[i]){ contenedor = array[i]; } } - return contenedor; + return contenedor +} + +function calcularPromedio(array){ + let contenedor; + for (i = 0; i < array.length; i++){ + contenedor = contenedor + array[i]; + + } + let prom = (contenedor / array.length); + return prom; } let $botonOk = document.querySelector('#boton-ok'); @@ -63,10 +73,12 @@ $botonOk.onclick = function(){ let menor = calcularMenor(arrayEdadesFamilia); let mayor = calcularMayor(arrayEdadesFamilia); + let promedio = calcularPromedio(arrayEdadesFamilia); + console.log(promedio); let pResultados = document.createElement('p'); - pResultados.textContent = `El mayor es ${mayor}, el menor es ${menor} y el promedio es /////`; + pResultados.textContent = `El mayor es ${mayor}, el menor es ${menor} y el promedio es ${promedio}`; divFamilia.appendChild(pResultados); From a69ebff1ebfee6bda55d50ded78a7c610251deea Mon Sep 17 00:00:00 2001 From: sergioatk <55900410+sergioatk@users.noreply.github.com> Date: Mon, 18 Nov 2019 21:06:58 -0300 Subject: [PATCH 7/9] deja andando las 3 funciones --- tareas/clase-6/tarea-6-sergio.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tareas/clase-6/tarea-6-sergio.js b/tareas/clase-6/tarea-6-sergio.js index 9940d623..84ab66d3 100644 --- a/tareas/clase-6/tarea-6-sergio.js +++ b/tareas/clase-6/tarea-6-sergio.js @@ -29,7 +29,7 @@ function calcularMenor(array){ } function calcularPromedio(array){ - let contenedor; + let contenedor = 0; for (i = 0; i < array.length; i++){ contenedor = contenedor + array[i]; @@ -68,7 +68,7 @@ $botonOk.onclick = function(){ let arrayEdadesFamilia = []; for (let i = 0; i < edadesFamilia.length; i++){ - arrayEdadesFamilia.push(edadesFamilia[i].value); + arrayEdadesFamilia.push(Number(edadesFamilia[i].value)); } let menor = calcularMenor(arrayEdadesFamilia); From 136b2b4e474cfb3aa96b239275f899e600e5cabf Mon Sep 17 00:00:00 2001 From: sergioatk <55900410+sergioatk@users.noreply.github.com> Date: Mon, 18 Nov 2019 21:12:43 -0300 Subject: [PATCH 8/9] Deja boton reiniciar andando --- tareas/clase-6/tarea-6-sergio.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tareas/clase-6/tarea-6-sergio.js b/tareas/clase-6/tarea-6-sergio.js index 84ab66d3..655dcdb6 100644 --- a/tareas/clase-6/tarea-6-sergio.js +++ b/tareas/clase-6/tarea-6-sergio.js @@ -57,10 +57,19 @@ $botonOk.onclick = function(){ } let $botonCalcular = document.createElement('button'); - $botonCalcular.innerHTML = 'calcular'; + $botonCalcular.innerHTML = 'Calcular'; $botonCalcular.id = 'boton-calcular'; divFamilia.appendChild($botonCalcular); + let $botonReiniciar = document.createElement('button'); + $botonReiniciar.innerHTML = 'Reiniciar'; + $botonReiniciar.id = 'boton-reiniciar'; + divFamilia.appendChild($botonReiniciar); + + $botonReiniciar.onclick = function(){ + location.reload(); + } + $botonCalcular.onclick = function(){ From 61cb9c3ef00899d8c53180ebd762d8404faf2e7c Mon Sep 17 00:00:00 2001 From: sergioatk <55900410+sergioatk@users.noreply.github.com> Date: Thu, 5 Mar 2020 10:39:58 -0300 Subject: [PATCH 9/9] Update .gitignore --- .gitignore | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/.gitignore b/.gitignore index e69de29b..90420288 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,153 @@ + +node_modules/bootstrap/scss/vendor/_rfs.scss +node_modules/bootstrap/scss/utilities/_visibility.scss +node_modules/bootstrap/scss/utilities/_text.scss +node_modules/bootstrap/scss/utilities/_stretched-link.scss +node_modules/bootstrap/scss/utilities/_spacing.scss +node_modules/bootstrap/scss/utilities/_sizing.scss +node_modules/bootstrap/scss/utilities/_shadows.scss +node_modules/bootstrap/scss/utilities/_screenreaders.scss +node_modules/bootstrap/scss/utilities/_position.scss +node_modules/bootstrap/scss/utilities/_overflow.scss +node_modules/bootstrap/scss/utilities/_float.scss +node_modules/bootstrap/scss/utilities/_flex.scss +node_modules/bootstrap/scss/utilities/_embed.scss +node_modules/bootstrap/scss/utilities/_display.scss +node_modules/bootstrap/scss/utilities/_clearfix.scss +node_modules/bootstrap/scss/utilities/_borders.scss +node_modules/bootstrap/scss/utilities/_background.scss +node_modules/bootstrap/scss/utilities/_align.scss +node_modules/bootstrap/scss/mixins/_visibility.scss +node_modules/bootstrap/scss/mixins/_transition.scss +node_modules/bootstrap/scss/mixins/_text-truncate.scss +node_modules/bootstrap/scss/mixins/_text-hide.scss +node_modules/bootstrap/scss/mixins/_text-emphasis.scss +node_modules/bootstrap/scss/mixins/_table-row.scss +node_modules/bootstrap/scss/mixins/_size.scss +node_modules/bootstrap/scss/mixins/_screen-reader.scss +node_modules/bootstrap/scss/mixins/_resize.scss +node_modules/bootstrap/scss/mixins/_reset-text.scss +node_modules/bootstrap/scss/mixins/_pagination.scss +node_modules/bootstrap/scss/mixins/_nav-divider.scss +node_modules/bootstrap/scss/mixins/_lists.scss +node_modules/bootstrap/scss/mixins/_list-group.scss +node_modules/bootstrap/scss/mixins/_image.scss +node_modules/bootstrap/scss/mixins/_hover.scss +node_modules/bootstrap/scss/mixins/_grid.scss +node_modules/bootstrap/scss/mixins/_grid-framework.scss +node_modules/bootstrap/scss/mixins/_gradients.scss +node_modules/bootstrap/scss/mixins/_forms.scss +node_modules/bootstrap/scss/mixins/_float.scss +node_modules/bootstrap/scss/mixins/_deprecate.scss +node_modules/bootstrap/scss/mixins/_clearfix.scss +node_modules/bootstrap/scss/mixins/_caret.scss +node_modules/bootstrap/scss/mixins/_buttons.scss +node_modules/bootstrap/scss/mixins/_breakpoints.scss +node_modules/bootstrap/scss/mixins/_box-shadow.scss +node_modules/bootstrap/scss/mixins/_border-radius.scss +node_modules/bootstrap/scss/mixins/_badge.scss +node_modules/bootstrap/scss/mixins/_background-variant.scss +node_modules/bootstrap/scss/mixins/_alert.scss +node_modules/bootstrap/scss/bootstrap.scss +node_modules/bootstrap/scss/bootstrap-reboot.scss +node_modules/bootstrap/scss/bootstrap-grid.scss +node_modules/bootstrap/scss/_variables.scss +node_modules/bootstrap/scss/_utilities.scss +node_modules/bootstrap/scss/_type.scss +node_modules/bootstrap/scss/_transitions.scss +node_modules/bootstrap/scss/_tooltip.scss +node_modules/bootstrap/scss/_toasts.scss +node_modules/bootstrap/scss/_tables.scss +node_modules/bootstrap/scss/_spinners.scss +node_modules/bootstrap/scss/_root.scss +node_modules/bootstrap/scss/_reboot.scss +node_modules/bootstrap/scss/_progress.scss +node_modules/bootstrap/scss/_print.scss +node_modules/bootstrap/scss/_popover.scss +node_modules/bootstrap/scss/_pagination.scss +node_modules/bootstrap/scss/_navbar.scss +node_modules/bootstrap/scss/_nav.scss +node_modules/bootstrap/scss/_modal.scss +node_modules/bootstrap/scss/_mixins.scss +node_modules/bootstrap/scss/_media.scss +node_modules/bootstrap/scss/_list-group.scss +node_modules/bootstrap/scss/_jumbotron.scss +node_modules/bootstrap/scss/_input-group.scss +node_modules/bootstrap/scss/_images.scss +node_modules/bootstrap/scss/_grid.scss +node_modules/bootstrap/scss/_functions.scss +node_modules/bootstrap/scss/_forms.scss +node_modules/bootstrap/scss/_dropdown.scss +node_modules/bootstrap/scss/_custom-forms.scss +node_modules/bootstrap/scss/_code.scss +node_modules/bootstrap/scss/_close.scss +node_modules/bootstrap/scss/_carousel.scss +node_modules/bootstrap/scss/_card.scss +node_modules/bootstrap/scss/_buttons.scss +node_modules/bootstrap/scss/_button-group.scss +node_modules/bootstrap/scss/_breadcrumb.scss +node_modules/bootstrap/scss/_badge.scss +node_modules/bootstrap/scss/_alert.scss +node_modules/bootstrap/README.md +node_modules/bootstrap/package.json +node_modules/bootstrap/LICENSE +node_modules/bootstrap/js/src/util.js +node_modules/bootstrap/js/src/tooltip.js +node_modules/bootstrap/js/src/tools/sanitizer.js +node_modules/bootstrap/js/src/toast.js +node_modules/bootstrap/js/src/tab.js +node_modules/bootstrap/js/src/scrollspy.js +node_modules/bootstrap/js/src/popover.js +node_modules/bootstrap/js/src/modal.js +node_modules/bootstrap/js/src/index.js +node_modules/bootstrap/js/src/dropdown.js +node_modules/bootstrap/js/src/collapse.js +node_modules/bootstrap/js/src/carousel.js +node_modules/bootstrap/js/src/button.js +node_modules/bootstrap/js/src/alert.js +node_modules/bootstrap/js/dist/util.js.map +node_modules/bootstrap/js/dist/util.js +node_modules/bootstrap/js/dist/tooltip.js.map +node_modules/bootstrap/js/dist/tooltip.js +node_modules/bootstrap/js/dist/toast.js.map +node_modules/bootstrap/js/dist/toast.js +node_modules/bootstrap/js/dist/tab.js.map +node_modules/bootstrap/js/dist/tab.js +node_modules/bootstrap/js/dist/scrollspy.js.map +node_modules/bootstrap/js/dist/scrollspy.js +node_modules/bootstrap/js/dist/popover.js.map +node_modules/bootstrap/js/dist/popover.js +node_modules/bootstrap/js/dist/modal.js.map +node_modules/bootstrap/js/dist/modal.js +node_modules/bootstrap/js/dist/index.js.map +node_modules/bootstrap/js/dist/index.js +node_modules/bootstrap/js/dist/dropdown.js.map +node_modules/bootstrap/js/dist/dropdown.js +node_modules/bootstrap/js/dist/collapse.js.map +node_modules/bootstrap/js/dist/collapse.js +node_modules/bootstrap/js/dist/carousel.js.map +node_modules/bootstrap/js/dist/carousel.js +node_modules/bootstrap/js/dist/button.js.map +node_modules/bootstrap/js/dist/button.js +node_modules/bootstrap/js/dist/alert.js.map +node_modules/bootstrap/js/dist/alert.js +node_modules/bootstrap/dist/js/bootstrap.min.js.map +node_modules/bootstrap/dist/js/bootstrap.min.js +node_modules/bootstrap/dist/js/bootstrap.js.map +node_modules/bootstrap/dist/js/bootstrap.js +node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map +node_modules/bootstrap/dist/js/bootstrap.bundle.min.js +node_modules/bootstrap/dist/js/bootstrap.bundle.js.map +node_modules/bootstrap/dist/js/bootstrap.bundle.js +node_modules/bootstrap/dist/css/bootstrap.min.css.map +node_modules/bootstrap/dist/css/bootstrap.min.css +node_modules/bootstrap/dist/css/bootstrap.css.map +node_modules/bootstrap/dist/css/bootstrap.css +node_modules/bootstrap/dist/css/bootstrap-reboot.min.css.map +node_modules/bootstrap/dist/css/bootstrap-reboot.min.css +node_modules/bootstrap/dist/css/bootstrap-reboot.css.map +node_modules/bootstrap/dist/css/bootstrap-reboot.css +node_modules/bootstrap/dist/css/bootstrap-grid.min.css.map +node_modules/bootstrap/dist/css/bootstrap-grid.min.css +node_modules/bootstrap/dist/css/bootstrap-grid.css.map +node_modules/bootstrap/dist/css/bootstrap-grid.css