CONDITIONALS Flashcards
What is an if statement ?
Anifstatement checks a condition and will execute a task if that condition evaluates totrue
What is this logical operator && ?
Logical operator AND : checks if both provided expressions are truthy
What is this logical operator || ?
Logical operator OR : checks if either provided expression is truthy
What is this !
The bang operator,!, switches the truthiness and falsiness of a value.
What is switch ?
Aswitchstatement can be used to simplify the process of writing multipleelse ifstatements.
What is the meaning of thebreakkeyword ?
Tells the computer to exit the block and not execute any more code or check any other cases inside the code block.
What does the case keyword ?
Thecasekeyword checks if the expression matches the specified value that comes after it.
What is theternary operator?
is shorthand to simplify conciseif…elsestatements.
isNightTime ?console.log(‘Turn on the lights!’) :console.log(‘Turn off the lights!’);
Likeif…elsestatements, ternary operators can be used for conditions which evaluate totrueorfalse.