I have myself a IF state,
tempNum2 = 4, tempNum2 = 3
answer1 = 1, answer2 = 3, answer3 = 2, answer4 = 4
if( (tempNum2== answer2 || tempNum1== answer2) &&
(tempNum2!= answer1 || tempNum1!= answer1) &&
(tempNum2!= answer4 || tempNum1!= answer4) &&
(tempNum2!= answer3 || tempNum1!= answer3) &&
(asnwer5 == 0))
{
console.log("Correct");
}
now looking at the if statement, tempNum2 is equal to answer4, but in my firefox console, it prints out Correct, looking at the if statement, it should fail. Because tempNum2 is 4, and answer4 = 4, so this if statement should fail, what is wrong with this statement? Dont worry about anything else, I’m sure I have this if statement wrong.
Canvas
You have to have one of all 4 or clauses, as you are using an and everywhere. Plus I don’t know what answer 5 is, so I can’t speak to that, but it should also be true, however it is defined. It is possible that if you change your
&&to||,it will work, but I don’t know what logic you are trying to use.I don’t know what logic you want exactly, but your code is doing exactly what you told it to. In fact:
So, unless
tempNum2= tempNum1= answer2, this logic will always return false.