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
Control Flow · easy
12. Narrowing: Null Checks
Handling potentially null values.
Write `upper(str)`: if `str` is `null`, return 'N/A', else return uppercase.
Required in your answer:
str === null
Reveal solution
Run & check
Reset
Transpiled, then run in a sandbox
function upper(str: string | null) { // TODO }
Output appears here.
← 11. Narrowing: typeof
13. The unknown Type →