jtified Posted August 29, 2009 Report Share Posted August 29, 2009 [/color] var a =10; var b = 20; result = (a && ; document.write(result); Quote Link to comment Share on other sites More sharing options...
falkencreative Posted August 29, 2009 Report Share Posted August 29, 2009 I'm not sure if you are using "&&" and "||" the way they are intended to be used in javascript. As far as I know, they are intended to be used as part of a conditional statement, like "if" or a "while" loop.... if (var1 10) for example. If you are wanting to combine the two variables, for example, 10+20, or "cat" + "dog" you'll need to use "+". Combining booleans will give you their value (false = 0, true = 1). --- I will point out that: -- if you try to use "20 && 10", the result will always be the last variable ("10") -- if you use " "cat && "dog" " (you need "" around the text, because they are strings) you'll get the last variable ("dog") -- if you use "true && false", you'll get false if any one of the variables are false (order doesn't matter) and true otherwise. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.