please have a look on my if condition. I am just refreshing my javascript and I am wondering, how I could check, if the inserted variables, are the ones I want to be used.
if(choice1 && choice2 === "rock" || "paper" || scissors) {
Could anyone give me a short explanation, why the if condition passes every value it gets?
Because it will be evaluated as
if ((choice && (choice2 === "rock")) || "paper" || scissors )
which is probably not what you wanted. The non-empty string "paper"
is a truthy value, which means it will always fulfill the condition (and due to short-circuit evaluation, the reference error scissors
will not be looked at).
See Check variable equality against a list of values (and its many linked duplicates) for how to do it correctly.