Answer by dahui for Comparing strings with logical operators in an IF statement
Try:else if (choice1 !== "rock" || choice1 !== "paper" || choice1 !== "scissors")Your statement doesn't compile as "choice1 not equal to rock, paper, or scissors."The compiler reads it as:choice1 not...
View ArticleAnswer by Neil for Comparing strings with logical operators in an IF statement
// ...else if (choice1 !== "rock" || choice1 !== "paper" || choice1 !== "scissors") { return "Your only options are rock, paper, or scissors you friggin plebian!";} // ...Boolean expressions don't read...
View ArticleAnswer by user5398447 for Comparing strings with logical operators in an IF...
else if (choice1 !== "rock" || "paper" || "scissors") should be:else if (choice1 !== "rock" || choice1 !== "paper" || choice1 !== "scissors")
View ArticleComparing strings with logical operators in an IF statement
I am trying to figure out how to compare strings within an if statement. Most of my code can be ignored, but is there for context. I am trying to add a message to my simple rock, paper, scissors game...
View Article
More Pages to Explore .....