Function returns value with prompt
<html><head>
<title> Function returns value with prompt </title>
<script>
function theAbsoluteValue()
{
let question = prompt("Enter a number", "");
return question;
}
function displayIt(where, whatFunction) //DISPLAY ANSWER
{
document.getElementById(where).innerHTML = whatFunction;
}
</script>
</head>
<body>
<button onclick="displayIt('div1', theAbsoluteValue());">
Enter Number
</button>
<div id="div1"></div>
</body>
</html>
<title> Function returns value with prompt </title>
<script>
function theAbsoluteValue()
{
let question = prompt("Enter a number", "");
return question;
}
function displayIt(where, whatFunction) //DISPLAY ANSWER
{
document.getElementById(where).innerHTML = whatFunction;
}
</script>
</head>
<body>
<button onclick="displayIt('div1', theAbsoluteValue());">
Enter Number
</button>
<div id="div1"></div>
</body>
</html>