From f243a51ee8b59e9e90932a185e7ee5229f307831 Mon Sep 17 00:00:00 2001 From: roly007ram Date: Wed, 17 Aug 2022 21:34:02 -0300 Subject: [PATCH 1/4] el primero --- 02-JS-I/homework/homework.js | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/02-JS-I/homework/homework.js b/02-JS-I/homework/homework.js index 3c92ac9cdf..2800c46379 100644 --- a/02-JS-I/homework/homework.js +++ b/02-JS-I/homework/homework.js @@ -1,22 +1,22 @@ // En estas primeras 6 preguntas, reemplaza `null` por la respuesta // Crea una variable "string", puede contener lo que quieras: -const nuevaString = null; +const nuevaString = "casa"; // Crea una variable numérica, puede ser cualquier número: -const nuevoNum = null; +const nuevoNum = 1; // Crea una variable booleana: -const nuevoBool = null; +const nuevoBool = treu; // Resuelve el siguiente problema matemático: -const nuevaResta = 10 - null === 5; +const nuevaResta = 10 - 5 === 5; // Resuelve el siguiente problema matemático: -const nuevaMultiplicacion = 10 * null === 40 ; +const nuevaMultiplicacion = 10 * 4 === 40 ; // Resuelve el siguiente problema matemático: -const nuevoModulo = 21 % 5 === null; +const nuevoModulo = 21 % 5 === 1; // En los próximos 22 problemas, deberás completar la función. @@ -28,6 +28,8 @@ const nuevoModulo = 21 % 5 === null; function devolverString(str) { // "Return" la string provista: str // Tu código: + str="casa"; + return str; } @@ -35,38 +37,49 @@ function suma(x, y) { // "x" e "y" son números // Suma "x" e "y" juntos y devuelve el valor // Tu código: - + suma = x + y; + return suma; } function resta(x, y) { // Resta "y" de "x" y devuelve el valor // Tu código: - + resta=x-y; + return + } function multiplica(x, y) { // Multiplica "x" por "y" y devuelve el valor // Tu código: - + multiplica=x * y; + return; } function divide(x, y) { // Divide "x" entre "y" y devuelve el valor // Tu código: - + divide=x/y; + return; } function sonIguales(x, y) { // Devuelve "true" si "x" e "y" son iguales // De lo contrario, devuelve "false" // Tu código: - + sonIguales=x===y; + return; } function tienenMismaLongitud(str1, str2) { // Devuelve "true" si las dos strings tienen la misma longitud // De lo contrario, devuelve "false" // Tu código: + if (str1.length === str2.length){ + return true; + } else { + return false; + } } From a0cd727b669289e197ba5b40d304724b0cc4d750 Mon Sep 17 00:00:00 2001 From: roly007ram Date: Wed, 24 Aug 2022 16:48:15 -0300 Subject: [PATCH 2/4] prueba --- 02-JS-I/homework/homework.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/02-JS-I/homework/homework.js b/02-JS-I/homework/homework.js index 2800c46379..12d254b9f3 100644 --- a/02-JS-I/homework/homework.js +++ b/02-JS-I/homework/homework.js @@ -87,7 +87,10 @@ function menosQueNoventa(num) { // Devuelve "true" si el argumento de la función "num" es menor que noventa // De lo contrario, devuelve "false" // Tu código: - + if (num < 90){ + return true; + } + return false; } function mayorQueCincuenta(num) { From a9533ae2670606c0e1f45d7b4865db927ae3d132 Mon Sep 17 00:00:00 2001 From: roly007ram Date: Wed, 24 Aug 2022 16:53:47 -0300 Subject: [PATCH 3/4] prueba2 --- 02-JS-I/homework/homework.js | 103 ++++++++++++++++++++++------------- 1 file changed, 65 insertions(+), 38 deletions(-) diff --git a/02-JS-I/homework/homework.js b/02-JS-I/homework/homework.js index 12d254b9f3..325f273494 100644 --- a/02-JS-I/homework/homework.js +++ b/02-JS-I/homework/homework.js @@ -1,13 +1,13 @@ // En estas primeras 6 preguntas, reemplaza `null` por la respuesta // Crea una variable "string", puede contener lo que quieras: -const nuevaString = "casa"; +const nuevaString = null; // Crea una variable numérica, puede ser cualquier número: -const nuevoNum = 1; +const nuevoNum = 15; // Crea una variable booleana: -const nuevoBool = treu; +const nuevoBool = null; // Resuelve el siguiente problema matemático: const nuevaResta = 10 - 5 === 5; @@ -28,8 +28,6 @@ const nuevoModulo = 21 % 5 === 1; function devolverString(str) { // "Return" la string provista: str // Tu código: - str="casa"; - return str; } @@ -37,49 +35,38 @@ function suma(x, y) { // "x" e "y" son números // Suma "x" e "y" juntos y devuelve el valor // Tu código: - suma = x + y; - return suma; + } function resta(x, y) { // Resta "y" de "x" y devuelve el valor // Tu código: - resta=x-y; - return - + } function multiplica(x, y) { // Multiplica "x" por "y" y devuelve el valor // Tu código: - multiplica=x * y; - return; + } function divide(x, y) { // Divide "x" entre "y" y devuelve el valor // Tu código: - divide=x/y; - return; + } function sonIguales(x, y) { // Devuelve "true" si "x" e "y" son iguales // De lo contrario, devuelve "false" // Tu código: - sonIguales=x===y; - return; + } function tienenMismaLongitud(str1, str2) { // Devuelve "true" si las dos strings tienen la misma longitud // De lo contrario, devuelve "false" // Tu código: - if (str1.length === str2.length){ - return true; - } else { - return false; - } } @@ -87,23 +74,28 @@ function menosQueNoventa(num) { // Devuelve "true" si el argumento de la función "num" es menor que noventa // De lo contrario, devuelve "false" // Tu código: - if (num < 90){ + if (90 > num) { return true; } return false; + } function mayorQueCincuenta(num) { // Devuelve "true" si el argumento de la función "num" es mayor que cincuenta // De lo contrario, devuelve "false" // Tu código: - + if (50 < num) { + return true; + } + return false; } function obtenerResto(x, y) { // Obten el resto de la división de "x" entre "y" // Tu código: - + return x % y ; + } function esPar(num) { @@ -111,12 +103,19 @@ function esPar(num) { // De lo contrario, devuelve "false" // Tu código: +} + return false; } function esImpar(num) { // Devuelve "true" si "num" es impar // De lo contrario, devuelve "false" // Tu código: + if( num %2 == 1){ + return true; + + } + return false; } @@ -124,37 +123,38 @@ function elevarAlCuadrado(num) { // Devuelve el valor de "num" elevado al cuadrado // ojo: No es raiz cuadrada! // Tu código: - + return Math.pow(num,2); } function elevarAlCubo(num) { // Devuelve el valor de "num" elevado al cubo // Tu código: - + return Math.pow(num,3); } function elevar(num, exponent) { // Devuelve el valor de "num" elevado al exponente dado en "exponent" // Tu código: - + return Math.pow(num,exponent); } function redondearNumero(num) { // Redondea "num" al entero más próximo y devuélvelo // Tu código: - + return Math.round(num); } function redondearHaciaArriba(num) { // Redondea "num" hacia arriba (al próximo entero) y devuélvelo // Tu código: - + return Math.ceil(num); } function numeroRandom() { //Generar un número al azar entre 0 y 1 y devolverlo //Pista: investigá qué hace el método Math.random() - + var numero=Math.random(); + return numero; } function esPositivo(numero) { @@ -162,46 +162,66 @@ function esPositivo(numero) { //Si el número es positivo, devolver ---> "Es positivo" //Si el número es negativo, devolver ---> "Es negativo" //Si el número es 0, devuelve false - -} + if(numero === 0){ + + return false; + + }else if(numero > 0) { + + return("Es positivo"); + + }else{ + + return("Es negativo"); + + }; + +}; function agregarSimboloExclamacion(str) { // Agrega un símbolo de exclamación al final de la string "str" y devuelve una nueva string // Ejemplo: "hello world" pasaría a ser "hello world!" // Tu código: + return str + "!"; } function combinarNombres(nombre, apellido) { // Devuelve "nombre" y "apellido" combinados en una string y separados por un espacio. // Ejemplo: "Soy", "Henry" -> "Soy Henry" // Tu código: - + var combi = nombre + " "+ apellido; + return combi; + } function obtenerSaludo(nombre) { // Toma la string "nombre" y concatena otras string en la cadena para que tome la siguiente forma: // "Martin" -> "Hola Martin!" // Tu código: - + var frase = `Hola ${nombre}!`; + return frase; + } function obtenerAreaRectangulo(alto, ancho) { // Retornar el area de un rectángulo teniendo su altura y ancho // Tu código: - + + return ancho * alto; } function retornarPerimetro(lado){ //Escibe una función a la cual reciba el valor del lado de un cuadrado y retorne su perímetro. //Escribe tu código aquí - + return lado * 4; } function areaDelTriangulo(base, altura){ //Desarrolle una función que calcule el área de un triángulo. //Escribe tu código aquí + return (base * altura) /2; } @@ -210,7 +230,7 @@ function deEuroAdolar(euro){ //Supongamos que 1 euro equivale a 1.20 dólares. Escribe un programa que reciba //como parámetro un número de euros y calcule el cambio en dólares. //Escribe tu código aquí - + return euro * 1.20; } @@ -220,7 +240,14 @@ function esVocal(letra){ //que no se puede procesar el dato mediante el mensaje "Dato incorrecto". // Si no es vocal, tambien debe devolver "Dato incorrecto". //Escribe tu código aquí - + if(letra.length > 1){ + return "Dato incorrecto"; + } + if(letra === "a" || letra === "e" || letra === "i" || letra === "o" || letra === "u"){ + return "Es vocal"; + } + return "Dato incorrecto"; + } From 894077b7c0db6e6f38983cbfd988d17ff1bf3bda Mon Sep 17 00:00:00 2001 From: roly007ram Date: Mon, 10 Oct 2022 13:51:49 -0300 Subject: [PATCH 4/4] terminado 6 --- 02-JS-I/homework/homework.js | 6 ++--- 06-JS-V/homework/homework.js | 50 +++++++++++++++++++++++++++++++++--- 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/02-JS-I/homework/homework.js b/02-JS-I/homework/homework.js index 325f273494..9abc05f4a6 100644 --- a/02-JS-I/homework/homework.js +++ b/02-JS-I/homework/homework.js @@ -1,13 +1,13 @@ // En estas primeras 6 preguntas, reemplaza `null` por la respuesta // Crea una variable "string", puede contener lo que quieras: -const nuevaString = null; +const nuevaString = "string"; // Crea una variable numérica, puede ser cualquier número: const nuevoNum = 15; // Crea una variable booleana: -const nuevoBool = null; +const nuevoBool = true; // Resuelve el siguiente problema matemático: const nuevaResta = 10 - 5 === 5; @@ -180,7 +180,7 @@ function esPositivo(numero) { function agregarSimboloExclamacion(str) { // Agrega un símbolo de exclamación al final de la string "str" y devuelve una nueva string - // Ejemplo: "hello world" pasaría a ser "hello world!" + // Ejemplo: "hello world" pasaría a ser "hello world!" // Tu código: return str + "!"; } diff --git a/06-JS-V/homework/homework.js b/06-JS-V/homework/homework.js index f7910b373e..3aa42a8207 100644 --- a/06-JS-V/homework/homework.js +++ b/06-JS-V/homework/homework.js @@ -8,12 +8,28 @@ function crearUsuario() { // {{nombre}} debe ser el nombre definido en cada instancia // Devuelve la clase // Tu código: + function Usuario(opciones) { + this.usuario = opciones.usuario; + this.nombre = opciones.nombre; + this.email = opciones.email; + this.password = opciones.password; + } + Usuario.prototype.saludar = function () { + return `Hola, mi nombre es ${this.nombre}`; + + } + return Usuario; } function agregarMetodoPrototype(Constructor) { // Agrega un método al Constructor del `prototype` // El método debe llamarse "saludar" y debe devolver la string "Hello World!" // Tu código: + Constructor.prototype.saludar = function(){ + return "Hello World!"; + } + + } function agregarStringInvertida() { @@ -22,6 +38,13 @@ function agregarStringInvertida() { // Ej: 'menem'.reverse() => menem // 'toni'.reverse() => 'inot' // Pista: Necesitarás usar "this" dentro de "reverse" + String.prototype.reverse = function () { + var palabrainvertida =""; + for (var i = this.length; i != 0; i--){ + palabrainvertida += this.charAt(i -1 ); + } + return palabrainvertida; + }; } // ---------------------------------------------------------------------------// @@ -36,8 +59,22 @@ function agregarStringInvertida() { // } class Persona { - constructor(/*Escribir los argumentos que recibe el constructor*/) { + constructor(nombre, apellido,edad, domicilio) { // Crea el constructor: + this.nombre = nombre; + this.apellido = apellido; + this.edad = edad; + this.domicilio = domicilio; + this.detalle = function() { + // crear obdeto desde funcion y rernar + return { + Nombre: this.nombre, + Apellido: this.apellido, + Edad: this.edad, + Domicilio: this.domicilio, + + } + }; } } @@ -46,17 +83,22 @@ function crearInstanciaPersona(nombre, apellido, edad, dir) { //Con esta función vamos a crear una nueva persona a partir de nuestro constructor de persona (creado en el ejercicio anterior) //Recibirá los valores "Juan", "Perez", 22, "Saavedra 123" para sus respectivas propiedades //Devolver la nueva persona creada + const persona = new Persona(nombre, apellido, edad, dir); + return persona; + } function agregarMetodo() { //La función agrega un método "datos" a la clase Persona que toma el nombre y la edad de la persona y devuelve: //Ej: "Juan, 22 años" + Persona.prototype.datos = function(){ + // return this.Nombre +", " + this.edad + "años" + return `${this.nombre}, ${this.edad} años`; + } } - // No modificar nada debajo de esta línea -// -------------------------------- - +// ---------------- module.exports = { crearUsuario, agregarMetodoPrototype,