Comparisons
9 lessons
- 01ConditionalsLearn how to use if, else if, and else statements to control the flow of your JavaScript programs.
- 02Comparison OperatorsUnderstand the difference between strict and loose equality, and how to safely compare values in JavaScript.
- 03Logical OperatorsCombine multiple conditions using logical AND, OR, and NOT operators.
- 04SwitchUse switch statements as a readable alternative to long if-else chains when checking a single variable against many values.
- 05Ternary OperatorLearn how to use the ternary operator as a shorthand for simple if-else statements.
- 06When to TernaryUnderstand the appropriate use cases for the ternary operator and why you should avoid nested ternaries.
- 07Truthy and FalsyLearn how JavaScript evaluates non-boolean values in a boolean context, and memorize the common truthy and falsy values.
- 08Nullish CoalescingUse the nullish coalescing operator (??) to concisely set default values when dealing with null or undefined variables.
- 09Chapter 2 Cheatsheet: Comparisons & LogicA quick summary and cheatsheet covering conditionals, logical operators, truthiness, and nullish coalescing.