TypeScript · Junior · Question 54 of 75
What is the type of users.find((u) => u.id === id) if users: User[]?
- ✓Correct answer:
User | undefined - 2
User - 3
User[]
Explanation
find may not find anything, so you must handle undefined before using the result.