Intermediate
TypeScript
Q77 / 100
What does "Array.isArray(value)" help with when narrowing a union type like "string | string[]"?
Correct! Well done.
Incorrect.
The correct answer is B) It acts as a type guard, narrowing the type to string[] within the true branch
B
Correct Answer
It acts as a type guard, narrowing the type to string[] within the true branch
Explanation
Array.isArray is recognized by TypeScript as a type guard, narrowing the checked value to an array type inside the conditional branch.
Progress
77/100