El código:
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Loops</h2>
<script>
document.write("Con For:"+"<br>");
for (i = 1; i < 11; i++) {
document.write(i+"<br>");
}
for (i = 100; i <= 120; i=i+2) {
document.write(i+"<br>");
}
document.write("Con While:"+"<br>");
//Empieza el while
var i=1;
while (i <= 10) {
document.write(i+"<br>");
i++;
}
var i= 100;
while (i <= 120) {
document.write(i+"<br>");
i=i+2;
}
//Empieza el Do While
var i =1;
document.write("Con Do While:"+"<br>");
do {
document.write(i+"<br>");
i++;
}
while (i <= 10);
var i =100;
do {
document.write(i+"<br>");
i=i+2;
}
while (i <= 120);
</script>
</body>
</html>
La pagina: https://magnitopic.github.io/edujs/reto2.html
Los retos: https://docs.google.com/document/d/18c89Xpp4nHCyUJAMh2spcXeUKmYxbZTPMSm0TlfyABc/edit?usp=sharing
No hay comentarios:
Publicar un comentario