Type Guard
Narrow with typeof.
💡 THINK OF IT LIKE…
▸ YOUR TURN
Write: if (typeof x === 'string') { x.toUpperCase(); }
Tab indent · Shift+Tab outdent · ⌘/Ctrl + Enter submit · auto-pairs ( [ { " '
Narrow with typeof.
Write: if (typeof x === 'string') { x.toUpperCase(); }