Advertisement
teslariu

funcion1

Jul 18th, 2022
1,167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.     <meta name="viewport" content="width=<device-width>, initial-scale=1.0">
  7.     <title>Probando JavaScript</title>
  8. </head>
  9. <body>
  10.     <h2>Tabla del 2</h2>
  11.     <p id="tabla"></p>
  12.    
  13.     <script>
  14.         // Desarrollar un script que muestre la tabla del 2 en forma vertical
  15.         // Tabla del 2:
  16.         // 2 x 0 = 0
  17.         // 2 x 1 = 2
  18.         // ....
  19.         // 2 x 9 = 18
  20.         // 2 x 10 = 20
  21.        
  22.         var salida = ""
  23.         for (var i=0; i<11; i++){
  24.             salida = salida + "2 x " + i + " = " + producto(i) + "<br>";
  25.         }
  26.         document.getElementById("tabla").innerHTML = salida;
  27.        
  28.         function producto(a){
  29.             return 2 * a
  30.         }
  31.        
  32.     </script>
  33.    
  34. </body>
  35. </html>
  36.  
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement