The code below works to a degree. I ask the user to input a number less than 10...if he puts in 10 or greater, I shoot him an alert saying his value is too high. Then the program ends. How can I put where the user, if he puts it greater than ten, go back to the original prompt to ask him again to input a value. I'm trying to learn javascript on my own, and this is puzzling me a little. I'm thinking a while loop may work, but wouldn't quite know how to do it. Any thoughts?
The code is below:
<html>
<title>Practice</title>
<head>
<script language="javascript">
var lowConstant = 10;
var numCounter = prompt("Please enter number","Number"
var StepUpCounter = parseInt(numCounter);
if (StepUpCounter >= lowConstant)
{
alert("Please enter number less than 10","XNumber"
}
else
{
document.writeln(smallLoop())
}
function smallLoop()
{StepUpCounter = StepUpCounter + lowConstant;
return StepUpCounter;
};
</script>
</head>
</html>