When using nullish coalescing (??) it is possible to create bugs by not using parenthesis. For example:
const shouldShowStreak = profile.streak ?? 0 > 1
The intention here is to default the optional streak property to 0, but JS will run default it to false, because 0 is not greater than 1.
When using nullish coalescing (
??) it is possible to create bugs by not using parenthesis. For example:The intention here is to default the optional
streakproperty to0, but JS will run default it tofalse, because 0 is not greater than 1.