Fill: Generic Function
Fill in the Blank Medium
Question
Fill in the blank to make this a generic identity function:
Code
function identity<T>(value: T): ___ {
return value;
}
Hint
The return type should match the type parameter.
Explanation
The return type is T. The function takes a value of type T and returns the same type T. This makes identity work with any type while preserving type safety.
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.