Complete the code to assign a default value using nullish coalescing.
const name = userInput [1] "Guest";
The ?? operator returns the right side if the left side is null or undefined.
Complete the code to safely assign a number or default using nullish coalescing.
const count: number = inputCount [1] 10;
The ?? operator ensures count is assigned inputCount unless it is null or undefined, otherwise 10.
Fix the error in the code by choosing the correct nullish coalescing operator.
const result = value [1] fallback;The ?? operator is correct here to handle null or undefined values properly.
Fill both blanks to create a typed variable with nullish coalescing default.
const message: string = inputMessage [1] [2];
Use ?? to check for null or undefined, and default to the string "No message".
Fill all three blanks to create a typed variable with nullish coalescing and a fallback number.
const total: number = (inputTotal [1] [2]) [3] 100;
First, inputTotal || null ensures a value or null, then ?? 100 sets fallback if null or undefined.