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
Types · medium
24. keyof Operator
Extract keys of an object type.
Write `getProperty(obj, key)` using `keyof` to ensure `key` is valid.
Required in your answer:
keyof T
T[K]
Reveal solution
Run & check
Reset
Transpiled, then run in a sandbox
function getProperty(obj, key) { return obj[key]; }
Output appears here.
← 23. Generic Constraints
25. Indexed Access Types →