Write a Generic Function
Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.
The problem
- medium
- Pro
You want a function that returns the first item of an array. Called with an array of numbers it should return a number, and with an array of users it should return a user, with no casting. Then you want a second function that reads a property from an object by name, where the compiler rejects property names that don't exist. Explain how you'd type both.
Talk this problem through with an AI coach
This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.