If co.chkShowRSB is false, what is the expected result? I would expect it to be false, but is this the way it works? And why?
var test = chkShow:co.chkShowRSB || true;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Ok, so you got the picture by now
x = false || true;assigns true. Why? It’s quite easy knowing the use of the short-circuit-operator is the same as doing:However, it’s mostly used to set default values for function arguments, so I’m guessing you’re assuming
xto be assigned the second operand if the first isundefined. There is no way to filter out undefined values exclusively except for explicitly checking for them. You should then use:Or, because
undefinedneedn’t beundefined, and you want to be absolutely sure: