Aviway Posted July 8, 2009 Report Share Posted July 8, 2009 Can i right more than one condition in the first "if" area?example: var num; nam=parseInt(prompt("Choose a number with 3 digits")); if ((nam<532)&&(nam>928)) {alert("haha")} The example is'nt work, why? Link to comment Share on other sites More sharing options...
casper3912 Posted July 8, 2009 Report Share Posted July 8, 2009 num =! nam ? Link to comment Share on other sites More sharing options...
justsomeguy Posted July 8, 2009 Report Share Posted July 8, 2009 When is a number going to be both less than 532 and also greater than 928? Link to comment Share on other sites More sharing options...
Aviway Posted July 8, 2009 Author Report Share Posted July 8, 2009 var num; num=parseInt(prompt("Choose a number with 3 digits")); if ((num<532)&&(num>928)) {alert("haha")} O.KStill not working!? Link to comment Share on other sites More sharing options...
justsomeguy Posted July 8, 2009 Report Share Posted July 8, 2009 It's working fine, see my post above. It's doing just what you're telling it to do. Link to comment Share on other sites More sharing options...
Aviway Posted July 8, 2009 Author Report Share Posted July 8, 2009 if i press a number that greater then 928 or smaller then 532, Then the alert will show! Link to comment Share on other sites More sharing options...
justsomeguy Posted July 8, 2009 Report Share Posted July 8, 2009 That alert will never show. There is no number that will satisfy this condition:if ((num<532)&&(num>928))There is no number that is smaller than 532 and larger than 928. There are numbers that are either smaller than 532, or larger than 928, but there's not a number that's both. Link to comment Share on other sites More sharing options...
Aviway Posted July 8, 2009 Author Report Share Posted July 8, 2009 so can you please right for me the correct JS code? Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted July 8, 2009 Report Share Posted July 8, 2009 if ((num<532)||(num>928)) Link to comment Share on other sites More sharing options...
Aviway Posted July 8, 2009 Author Report Share Posted July 8, 2009 thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now