Find: Missing Return Type
Find the Mistake Easy
Question
This function has a type error. Find the mistake:
Code
function getAge(): number {
return "25";
}
Hint
Look at what the function returns vs what it declares.
Explanation
The function declares a return type of number, but it returns the string "25" (with quotes). TypeScript errors: Type 'string' is not assignable to type 'number'. Fix: return the number 25 without quotes: return 25;.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.