Lesson content
Read, practise, then check your understanding
Arithmetic uses + - * / % **; + also concatenates strings. Prefer strict === and !== because loose equality applies complex coercion. Relational comparison can also coerce operands.
Safe defaults and access
const displayName = user?.profile?.name ?? "Anonymous";
const canEdit = authenticated && role === "editor";
const remainder = 17 % 5;
&& and || return operand values and short-circuit. ?? falls back only for null/undefined, preserving 0, false, and empty string. Optional chaining stops on a nullish base. Bitwise operators convert ordinary numbers to 32-bit integers; use BigInt operators for intentional large-integer bit work. Parenthesize mixed expressions for communication, not merely precedence.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.