Multiple of "2" - Javascript Number Operation

Javascript examples for Number Operation:Integer

Description

Multiple of "2"

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script>
var n = 10;//from w  ww.j a v a2 s  .com
function start() {
    var pre = document.getElementById("my-output");
    pre.innerHTML = "";
    for (var i=1 ; i<=n ; i++) {
        pre.innerHTML += i + " * 2 = " + (i * 2) + "\n";
    }
}
        
      </script> 
   </head> 
   <body> 
      <pre id="my-output">Click the button to see the resulting table.</pre> 
      <button onclick="start()">Show the table</button>  
   </body>
</html>

Related Tutorials