Skip to content
Open
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions M03 JavaScript Fundamentos/Ejercicio 01.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
// por el correspondiente.

// Crea una variable de tipo string.
const nuevoString = null;
const nuevoString = "null";

// Crea una variable de tipo number.
const nuevoNumero = null;
const nuevoNumero = 1;

// Crea una variable de tipo boolean.
const nuevoBoolean = null;
const nuevoBoolean = true;

// Resuelve el siguiente problema matemático.
const nuevaResta = 10 - null === 3;
const nuevaResta = 10 - 7 === 3;

// 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;

/*⚠️ NO MODIFIQUES NADA DEBAJO DE ESTO ⚠️*/
module.exports = {
Expand Down
6 changes: 6 additions & 0 deletions M03 JavaScript Fundamentos/Ejercicio 02.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,39 @@
function devolverString(string) {
// Debe retornar un string.
// Tu código:
return string
}

// ⛔️ "X" e "Y" son números.

function suma(x, y) {
// Retorna el resultado de su suma.
// Tu código:
return x + y;
}

function resta(x, y) {
// Retorna el resultado de la resta.
// Tu código:
return x - y;
}

function divide(x, y) {
// Retorna el resultado de su división.
// Tu código:
return x / y;
}

function multiplica(x, y) {
// Retorna el resultado de su multiplicación.
// Tu código:
return x * y;
}

function obtenerResto(x, y) {
// Obten el resto de la división de "x" entre "y".
// Tu código:
return x % y;
}

/*⚠️ NO MODIFIQUES NADA DEBAJO DE ESTO ⚠️*/
Expand Down
33 changes: 33 additions & 0 deletions M03 JavaScript Fundamentos/Ejercicio 03.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,69 @@ function sonIguales(x, y) {
// Retorna true si "x" e "y" son iguales.
// De lo contrario, retorna false.
// Tu código:
if (x === y){
return true;
}else{
return false;
}
}

function tienenMismaLongitud(str1, str2) {
// Retorna true si los dos strings tienen la misma longitud.
// De lo contrario, retorna false.
// Tu código:

var data1 = str1.length;
var data2 = str2.length;
if (data1 === data2) {
return true;
}else{
return false;
}
}

function menosQueNoventa(num) {
// Retorna true si el argumento "num" es menor que noventa.
// De lo contrario, retorna false.
// Tu código:
if (num < 90){
return true;
}else{
return false;
}
}

function mayorQueCincuenta(num) {
// Retorna true si el argumento "num" es mayor que cincuenta.
// De lo contrario, retorna false.
// Tu código:
if (num > 50){
return true;
}else{
return false;
}
}

function esPar(num) {
// Retorna true si "num" es par.
// De lo contrario, retorna false.
// Tu código:
if (num % 2 == 0){
return true;
}else{
return false;
}
}

function esImpar(num) {
// Retorna true si "num" es impar.
// De lo contrario, retorna false.
// Tu código:
if (num % 2 == 1){
return true;
}else{
return false;
}
}

/*⚠️ NO MODIFIQUES NADA DEBAJO DE ESTO ⚠️*/
Expand Down
7 changes: 7 additions & 0 deletions M03 JavaScript Fundamentos/Ejercicio 04.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,38 @@
function elevarAlCuadrado(num) {
// Retorna el valor de "num" elevado al cuadrado.
// Tu código:
return (Math.pow(num, 2))
}

function elevarAlCubo(num) {
// Retorna el valor de "num" elevado al cubo.
// Tu código:

return (Math.pow(num, 3))
}

function elevar(num, exponent) {
// Retorna el valor de "num" elevado al exponente "exponent".
// Tu código:
return (Math.pow(num, exponent))
}

function redondearNumero(num) {
// Redondea "num" al entero más próximo y retórnalo.
// Tu código:
return (Math.round(num));
}

function redondearHaciaArriba(num) {
// Redondea "num" hacia arriba y retórnalo.
// Tu código:
return (Math.ceil(num));
}

function numeroRandom() {
// Genera un número al azar entre 0 y 1 y retórnalo.
// Tu código:
return (Math.random(0,1));
}

/*⚠️ NO MODIFIQUES NADA DEBAJO DE ESTO ⚠️*/
Expand Down
54 changes: 54 additions & 0 deletions M03 JavaScript Fundamentos/Ejercicio 05.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,113 @@
/*5️⃣ EJERCICIO 05 5️⃣*/

function esPositivo(num) {

// La función recibe un entero. Devuelve como resultado un string que indica si el número
// es positivo o negativo.
// Si el número es positivo ---> "Es positivo".
// Si el número es negativo ---> "Es negativo".
// Si el número es 0, devuelve false.
// Tu código:

if(Math.sign(num) > 0){
return "Es positivo";
}else if (Math.sign(num) === 0){
return false;
}else{
return "Es negativo";
}
}

function agregarSimboloExclamacion(str) {

// Agrega un símbolo de exclamación al final del string "str" y retórnalo
// Ejemplo: "hello world" ---> "hello world!"
// Tu código:

var exclamacion = "!";
var concatena = str + exclamacion;
return concatena;

}

function combinarNombres(nombre, apellido) {

// Retorna "nombre" y "apellido" combinados en un mismo string pero separados por un espacio.
// Ejemplo: ("Soy", "Henry") ---> "Soy Henry"
// Tu código:

var resultado = nombre + " " + apellido;
return resultado;
}

function obtenerSaludo(nombre) {

// Toma el string "nombre" y concatena otra string en la cadena para que tome la siguiente forma:
// Ejemplo: "Martin" ---> "Hola Martin!"
// Tu código:

var string = 'Hola';
var dango= '!';
var resultado = string + " " + nombre + dango;
return resultado;
}

function obtenerAreaRectangulo(alto, ancho) {

// Retornar el área de un rectángulo teniendo su altura y ancho.
// Tu código:

var area = alto * ancho;
return area

}

function retornarPerimetro(lado) {

// La función recibe como argumento la medida de un lado de un cuadrado.
// Debes retornar su perímetro.
// Tu código:

var suma = lado + lado + lado + lado;
return suma;

}

function areaDelTriangulo(base, altura) {

// Calcula el área de un triángulo y retorna el resultado.
// Tu código:

var area = (base * altura)/2;
return area;
}

function deEuroAdolar(euro) {

// Supongamos que 1 euro equivale a 1.20 dólares.
// Debes calcular el valor recibido como argumento pasándolo a dolares.
// Tu código:

var dolar = euro * 1.20;
return (dolar);

}

function esVocal(letra) {

// Escribe una función que reciba una letra y, si es una vocal, muestre el mensaje “Es vocal”.
// Si el usuario ingresa un string de más de un caracter debes retornar el mensaje: "Dato incorrecto".
// Si no es vocal, tambien debe retornar "Dato incorrecto".
// Tu código:

if (letra.length > 1) {
return "Dato incorrecto";
} else if (letra === 'a' || letra === 'e' || letra === 'i' || letra === 'o' || letra === 'u') {
return "Es vocal";
} else {
return "Dato incorrecto";
}

}

/*⚠️ NO MODIFIQUES NADA DEBAJO DE ESTO ⚠️*/
Expand Down
Loading