<meta charset="UTF-8" />
<script>
var multiplier = 8;
for (let i = 1; i <= 10; i++) {
let result = multiplier * i;
document.write(multiplier + " por " + i + " es " + result + "<br>");
}
</script>
<meta charset="UTF-8" />
<script>
var multiplier = 8;
for (let i = 1; i <= 10; i++) {
let result = multiplier * i;
document.write(multiplier + " por " + i + " es " + result + "<br>");
}
</script>
Gustavo no se subio nada.
I decided to use the keyword "var" in the variable "multiplier" because in that way the variable is able to be used in any part through all the program and I used the declaration on the variables "i" as in "result" to be type of "let" because its scope is only needed in the for loop. I restrict the reach of this exercise to just the multiples of 8, but if it´s needed it´s easily workable to generalize this exercise to any multiple whatever needed. Thanks
Thanks for the announcement - notice Pablo Andrés Avila, I thought that I just have to copy the code from the text editor but seems that if you want to paste the code directly from your text editor you can not do it in such a manner, you need to use the tool given here in this answering box, I mean, you need to use the sign tag to enter code as an answer, Thanks again Pablo.
Hola a tod@s, buenas noches. Les comparto, la resolución de la actividad correspondiente.
<meta charset="UTF-8">
<script>
document.write("<h1><u>Tabla del 5</u></h1>");
document.write("5 por 1 es: " + 5 * 1 + "<br><br>");
document.write("5 por 2 es: " + 5 * 2 + "<br><br>");
document.write("5 por 3 es: " + 5 * 3 + "<br><br>");
document.write("5 por 4 es: " + 5 * 4 + "<br><br>");
document.write("5 por 5 es: " + 5 * 5 + "<br><br>");
document.write("5 por 6 es: " + 5 * 6 + "<br><br>");
document.write("5 por 7 es: " + 5 * 7 + "<br><br>");
document.write("5 por 8 es: " + 5 * 8 + "<br><br>");
document.write("5 por 9 es: " + 5 * 9 + "<br><br>");
document.write("5 por 10 es: " + 5 * 10 + "<br><br>");
document.write("<br>");
var tablaDeMultiplicar = 8;
document.write("<h1><u>Tabla del 8</u></h1>");
document.write(tablaDeMultiplicar + " x 1 = " + tablaDeMultiplicar * 1 + "<br><br>");
document.write(tablaDeMultiplicar + " x 2 = " + tablaDeMultiplicar * 2 + "<br><br>" );
document.write(tablaDeMultiplicar + " x 3 = " + tablaDeMultiplicar * 3 + "<br><br>" );
document.write(tablaDeMultiplicar + " x 4 = " + tablaDeMultiplicar * 4 + "<br><br>" );
document.write(tablaDeMultiplicar + " x 5 = " + tablaDeMultiplicar * 5 + "<br><br>" );
document.write(tablaDeMultiplicar + " x 6 = " + tablaDeMultiplicar * 6 + "<br><br>" );
document.write(tablaDeMultiplicar + " x 7 = " + tablaDeMultiplicar * 7 + "<br><br>" );
document.write(tablaDeMultiplicar + " x 8 = " + tablaDeMultiplicar * 8 + "<br><br>" );
document.write(tablaDeMultiplicar + " x 9 = " + tablaDeMultiplicar * 9 + "<br><br>" );
document.write(tablaDeMultiplicar + " x 10 = " + tablaDeMultiplicar * 10 + "<br><br>");
</script>
¡Saludos Cordiales!