I am trying to write a small program, and I have 3 conditions for the program to proceed.
- prompt user input again if hour > 12
- prompt user input again if hour < 1
- prompt user input again if hour === NaN (I am stuck with the 3rd condition)
Here is the code I wrote to cope with 1st 2 conditions and unable to do the 3rd.
let hour = parseInt(prompt('Enter Hour'));
while (hour > 12 || hour < 1) {
hour = parseInt(prompt('Enter Valid Hour'));
}
i am pretty new to coding. Help is appreciated.