Skip to content
Advertisement

Calculate the volume of cylinder with JavaScript using prototype

I’m a JavaScript noob and beginner so don’t get too hard on me.

I need to calculate the volume of a cylinder using a constructor function and prototype.

I’ve got a form with two inputs which 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.

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.

I’ve been looking at this for almost 24h now, but I’m not getting any progress..

This is my code:

JavaScript

JavaScript

Advertisement

Answer

JavaScript

I have modified some code, try to understand this, hope it will helps you !

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement