title: Calculate the volume of cylinder with JavaScript using prototype
body: <p>I'm a javascript noob and beginner so don't get too hard on me.</p>
  
  <p>I need to calculate the volume of a cylinder using a constructor function and prototype.</p>
  
  <p>I've got a form with two inputs wich i'll be getting the values from to do the calculation with. I have to create a new instance when the button is clicked and the calculation has to be outputted in the outcome input.</p>
  
  <p>I seem to be stuck at the part to get the values out of the inputs as my console always says that 'hoogte' and 'diameter' is undefined when I click the button.</p>
  
  <p>I've been looking at this for almost 24h now, but i'm not getting any progress..</p>
  
  <p>This is my code:</p>
  
  <pre><code>&lt;form action=""&gt;
      &lt;label&gt;
          Diameter: &lt;input type="text" id="diameter"&gt;&lt;br&gt;&lt;br&gt;
          Hoogte: &lt;input type="text" id="hoogte"&gt; &lt;br&gt;&lt;br&gt;
          &lt;input type="button" value="bereken" id="berekenBtn"&gt;&lt;br&gt;&lt;br&gt;
          &lt;input type="text" id="uitkomst"&gt;
      &lt;/label&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>-</p>
  
  <pre><code>&lt;script&gt;
      window.addEventListener("DOMContentLoaded", function () {
          document.getElementById("berekenBtn").addEventListener("click", bereken);
      });
  
      function Cylinder(hoogte, diameter) {
          this.hoogte = hoogte;
          this.diameter = diameter;
      }
  
      Cylinder.prototype.volume = function () {
          var radius = document.getElementById('diameter') = this.diameter / 2;
          var hoogte = document.getElementById('hoogte') = this.hoogte;
  
          var berekening = Math.PI * radius * radius * hoogte;
          //berekening.toFixed(4);
      }
  
  
      function bereken() {
          var myCylinder = new Cylinder(
              document.getElementById("uitkomst").value = Cylinder()
          )
          console.log(myCylinder);
      }
  &lt;/script&gt;
  </code></pre>