I need to have an if statement to check if a number is = 0, or between 5000 and 3600000. How can have it check all 3 conditions?
Number can be 0 or 5000 or above OR 3600000 or less. It can’t be -1, 1.1 2.3 or anything between 0 and 5.
Here is what I have now and this work for checking if less than 5000 or greater than 3600000
var intervalCheck = interval * digit
if(isNaN(intervalCheck))
{
alert("Must be a number.");
}
else if((intervalCheck < 5000)||(intervalCheck>=3600000))
{
alert("Must be between 5 seconds and 1 hour.");
}
else
{
localStorage["interval_setting"] = interval * digit;
saveActions();
}
You can combine as many logic operations as you want into one
ifstatement using any of the javascript logic and comparision operators.You can see a demo work here: http://jsfiddle.net/jfriend00/y5tRK/