Home » Javascript » How to get a value from an <input> rather than a prompt?

How to get a value from an <input> rather than a prompt?

Posted by: admin October 29, 2018 Leave a comment

Questions:

I’m trying to make a surface area of a cylinder calculator as a beginner project. So far I’ve only used JavaScript to make it and it works fine.

var radius = prompt("What is the radius?");
var height = prompt("What is the height?");

var answer = 6.28*radius*radius+6.28*radius*height;

alert(answer);
Answers: