if is one of the commonly used syntaxes, and its format is as follows
if(coditon) statement1 (else statement2)
Where, coditon can be any expression, not even a true boolean, because JavaScript will automatically convert it into a boolean.
If the condition execution result is true, statement1 is executed, if the condition is false, the result execution result is statment2, (if statement2 exists, else is not required)
Each conditional statement can be a single line of code or a block of code. Here is a simple example
The code copy is as follows:
var iNumber = Number(prompt("Please enter a number between 5 and 100"));
if (isNaN(iNumber))
document.write("You please confirm the number you entered.");
else if(iNumber > 100 || iNumber < 5 )
document.write("The value you entered is not in the range");
else
document.write("The value you entered is" + iNumber);