title: On click of any button should display the correct number for that button
body: <ul>
  <li>i am new to js</li>
  <li>i am trying to achieve this task --->On click of any button should display the correct number for that button. </li>
  <li>i am able to dispaly button with click event event</li>
  <li>but not sure how to display correct number</li>
  <li>providing my code below</li>
  <li>is it possible to schieve using closures too</li>
  </ul>
  
  <p><a href="https://jsfiddle.net/jcLr2kwL/" rel="nofollow">https://jsfiddle.net/jcLr2kwL/</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function myFunction() {
    document.getElementById("demo").innerHTML = "Hello World";
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button onclick="myFunction()"&gt;1&lt;/button&gt;
  &lt;button onclick="myFunction()"&gt;2&lt;/button&gt;
  &lt;button onclick="myFunction()"&gt;3&lt;/button&gt;
  &lt;button onclick="myFunction()"&gt;4&lt;/button&gt;
  &lt;button onclick="myFunction()"&gt;5&lt;/button&gt;
  &lt;button onclick="myFunction()"&gt;6&lt;/button&gt;
  
  &lt;p id="demo"&gt;&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>