In this program, the user will take input through the window prompt and find the square of a number in javascript.
<!DOCTYPE html>
<html>
<body>
<script>
function Square()
{
var a=prompt("enter a number:");
document.write("square of "+a+" is:"+(a*a));
}
</script>
<form>
<input type="button" value="Square" onclick="Square()">
</form>
</body>
</html>
Input has taken through javascript prompt method
enter a number:5 square of 5 is:25