Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <h2>Bucle while</h2>
- <p id="demo"></p>
- <h2>Bucle do-while</h2>
- <p id="demo2"></p>
- <script>
- var texto = "";
- var i = 0;
- while (i < 10) {
- texto += "<br>El numero es " + i;
- i++;
- }
- document.getElementById("demo").innerHTML = texto;
- </script>
- <script>
- var otroTexto = ""
- var i = 0;
- do {
- otroTexto += "<br>El numero es " + i;
- i++;
- }
- while (i < 10);
- document.getElementById("demo2").innerHTML = otroTexto;
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment