Intermediate
TypeScript
Q65 / 100
What does the "in" operator do as a type guard, e.g. "if ('swim' in animal)"?
Correct! Well done.
Incorrect.
The correct answer is B) Narrows the type of "animal" to ones that have a "swim" property
B
Correct Answer
Narrows the type of "animal" to ones that have a "swim" property
Explanation
The "in" operator type guard narrows a union type by checking whether a specific property exists on the object at runtime.
Progress
65/100