Exercise

The break statement in a switch statement is used to exit the switch block once a matching case is found and executed.

If there is no matching case in a switch statement, the default case (if provided) will be executed, or the switch block will be exited if there is no default case.

The default case in a switch statement is executed when none of the other cases match the expression being evaluated.

You can use the ternary operator (?) in JavaScript as a concise way to write conditional statements with the syntax: condition ? expression1 : expression2.

You can nest ternary operators in JavaScript to handle multiple conditions, but it's recommended to use if-else statements for clarity in such cases.

Short-circuit evaluation in JavaScript is a behavior where the evaluation of logical expressions stops as soon as the outcome can be determined.

Truthy values in JavaScript are values that evaluate to true in a boolean context, while falsy values are values that evaluate to false.

You can use logical operators (&&, ||, !) in JavaScript to perform logical operations such as AND, OR, and NOT on boolean values and expressions.

In JavaScript, == is the equality operator that compares two values for equality, while === is the strict equality operator that not only checks for equality of values but also checks for equality of types.

You can use the logical AND (&&) operator in JavaScript to combine two or more conditions and check if all of them are true.

javascript

if (condition1 && condition2) {
    // code to be executed if both condition1 and condition2 are true
}