Testing sets of conditions Flashcards
Type the operator that means and.
&&
Type the operator that means or.
||
When both sides of an operator have to be true to pass the test, what operator is it? Type it.
&&
When, if either or both sides of an operator is (are) true, the test passes, what operator is it? Type it.
||
Code the first line of an if statement that tests whether both are true: a has the same value as b and c has the same value as d.
if (a === b && c === d) {
Code the first line of an if statement that tests whether either or both are true: a has the same value as b or c doesn’t have the same value as d.
if (a === b || c !== d) {
Code the first line of an if statement that tests whether both are true: a first variable equals a second variable and also equals a third variable.
if (a === b && a === c) {
Code the first line of an if statement that tests whether either is true: a variable is less than or equal to a particular number or whether that same variable is greater than or equal to a second number.
if (a <= 10 || a >= 12) {
Code the first line of an if statement that tests whether (1) name is either “Ace” or “Bud” and (2) age is greater than 60.
if ((name === “Ace” || name === “Bud”) && age > 60) {
Code the first line of an if statement that tests whether (1) name is “Ace” and age is greater than 60 or (2) name is “Bud”.
if ((name === “Ace” && age > 60) || name === “Bud”) {
Code the first line of an if statement that tests whether (1) name is “Ace” and age is greater than 60 or (2) name is “Bud” or age is under 6.
if ((name === “Ace” && age > 60) || (name === “Bud” || age < 6)) {