Yashotantra Academy
AI · Blockchain · Cloud · Data
Dark mode active
Learn
Tracks
ABCD
Certification
More
▾
Dark mode active
Learn
Tracks
ABCD
Certification
Study
Theory
Code Lab
Build
Solidity IDE
Staking Sandbox
Simulation
Reference
Wallets
Gas Fees
Explorers
← Code Lab
TypeScript
0/50 solved · 0%
All lessons
lesson
code
Generics · medium
21. Generic Functions
Identity function for any type.
Write `identity<T>(arg)` that returns `arg`.
Required in your answer:
<T>
arg: T
: T
Reveal solution
Run & check
Reset
Transpiled, then run in a sandbox
function identity(arg) { // TODO }
Output appears here.
← 20. Pick Utility
22. Generic Interfaces →