title: onClick functions to calculate simple math
body: <p>I want to calculate simple math after I click the button using javascript and yes it like onClick function with parameters then simple math. I'm sorry that I'm a beginner in JavaScript</p>
  
  <p>The code is this.</p>
  
  <pre><code>&lt;html&gt;
    &lt;body&gt;
      &lt;button onclick="myFunction(4,3)"&gt;sasd&lt;/button&gt;
      &lt;p id="demo"&gt;&lt;/p&gt;
  
      &lt;script&gt;
        function myFunction(p1, p2) {
          x1= p1 * p2;
        }
        document.getElementById("demo").innerHTML = x1;
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>