I have been tasked with creating a curriculum program that prompts students to input the number of hours they study each day. However, I am encountering issues with getting the prompt command to function within this JavaScript code:
<html>
<body>
<script>
var studiedhours = prompt("How many hours do you study a day?");
if (studiedhours <= 0) {
alert{"Sorry, you must enter a number between 0 and 24"}
}
else if (studiedhours >= 5) {
alert("Well Done! \n Keep it up!")
}
else if (studiedhours >= 24) {
alert("Sorry, there are only 24 hours in a day, you entered an invalid number")
}
else {
alert("You should study more!")
}
</script>
</body>
</html>
Why is the prompt command not functioning properly in this script?