Beginner
The List That Might Be Empty
firstWord promises a string, but with noUncheckedIndexedAccess the item words[0] is string | undefined. Fix the function so an empty list gives the text (none).
Do not change the return type.
What Check tests
- Your code has no type errors
- The first call prints
red - The empty list prints
(none) - The return type is still
string
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Press Run to see the page.
Console
Nothing printed yet.