Question 14
Back to Exercise
user is undefined. What happens with if (user?.isAdmin) { … }?
- A The condition is undefined (falsy), so the block is skipped without an error Correct
- B A TypeError is thrown
- C The block runs
- D A ReferenceError is thrown
Correct Answer: Option A
user?.isAdmin evaluates to undefined when user is null or undefined, and undefined is falsy.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!