JSβΊOperators
βOperatorsbeginnerFreeJS
operatorstypeofnullish coalescingdeletevoidcommainstanceofinbitwise
0/8 done~67 min
1
Mental model: Operators
Mental
~5 min
2
The 15 operator exceptions
Exceptions
~17 min
3
Predict the output
Predict
~12 min
4
True or false?
T/F
~4 min
5
Fill in the blanks
Fill
~3 min
6
Fix the bugs
Fix Bug
~7 min
7
Spot the bug
Spot Bug
~4 min
8
Put it together
Cement
~15 min
1 / 8Read~5 min
Mental model: Operators
Build the right picture in your head before we practice.
The + operator is the most dangerous coercion trigger: the moment either side is a string, everything becomes string concatenation. Use ?? instead of || when you need to preserve 0 and '' as valid values.
JavaScript operators silently coerce types. + with any string converts the whole expression to string. || returns the first truthy value β 0, '', null, false are all falsy, so || skips them. ?? (nullish coalescing) only skips null and undefined, making it safe for numeric and string defaults. typeof and instanceof have subtle cross-realm and null pitfalls.
Scroll to the bottom to continue
Notes
π
Loadingβ¦
Sections
0/8 done~67 min
1
Mental model: Operators
Mental
~5 min
2
The 15 operator exceptions
Exceptions
~17 min
3
Predict the output
Predict
~12 min
4
True or false?
T/F
~4 min
5
Fill in the blanks
Fill
~3 min
6
Fix the bugs
Fix Bug
~7 min
7
Spot the bug
Spot Bug
~4 min
8
Put it together
Cement
~15 min
Notes
Notes
π
Loadingβ¦