Hola a todos!
Les comparto mi solución del desafío.
// 1
function calculateIMC(weight, height) {
return weight / Math.pow(height, 2);
}
// 2
function factorial(n1) {
if (n1 == 0) return 1;
return n1 * factorial(n1 - 1);
}
// 3
function exchange(dollars) {
let realValue = 4.8;
return dollars * realValue;
}
// 4
function rectangleData(height, width) {
let perimeter = height * 2 + width * 2;
let area = width * height;
alert(`El perimnetro es: ${perimeter} y el area es ${area}.`);
}
// 5
function circleData(radius) {
let pi = 3.14;
let perimeter = pi * (radius * 2);
let area = pi * Math.pow(radius, 2);
alert(`El perimetro es: ${perimeter} y el area es ${area}.`);
}
// 6
function multiply(num) {
txt = '';
for (var i = 0; i <= 12; i++) {
txt += `${i} * ${num} = ${i * num} \n`;
}
alert(txt);
}